public Vector3 CellToWorld (Vector3Int cellPosition);

Parameters

cellPositionCell position to convert.

Returns

Vector3 World position of the cell position.

Description

Converts a cell position to world position space.

// Snap the GameObject to parent GridLayout
using UnityEngine;

public class ExampleClass : MonoBehaviour { void Start() { GridLayout gridLayout = transform.parent.GetComponentInParent<GridLayout>(); Vector3Int cellPosition = gridLayout.WorldToCell(transform.position); transform.position = gridLayout.CellToWorld(cellPosition); } }