기술 자료

Unity Engine

Unity Engine

root

Returns the topmost transform in the hierarchy.
읽는 시간 1분최근 업데이트: 한 달 전

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public Transform root { get; }

Remarks

(This never returns null, if this Transform doesn't have a parent it returns itself.)

Examples

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"); } }}