Version: 2020.1
言語: 日本語
public Transform root ;

説明

階層の一番上の Transform

( Transform が親を持たない場合は自身を返すことになり、null が返ることはありません。)

using UnityEngine;

public class Example : MonoBehaviour { // Is a collision between two objects with different roots? void OnCollisionEnter(Collision collision) { if (collision.transform.root != transform.root) { print("The colliding objects are not in the same hierarchy"); } } }