Version: 2022.3
言語: 日本語
public Vector3 CellToLocal (Vector3Int cellPosition);

パラメーター

cellPosition Cell position to convert.

戻り値

Vector3 Local position of the cell position.

説明

Converts a cell position to local position space.

// Snap the GameObject to parent GridLayout
using UnityEngine;

public class ExampleClass : MonoBehaviour { void Start() { GridLayout gridLayout = transform.parent.GetComponent<GridLayout>(); Vector3Int cellPosition = gridLayout.LocalToCell(transform.localPosition); transform.localPosition = gridLayout.CellToLocal(cellPosition); } }