Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

Transform.root

マニュアルに切り替える
public Transform root;

説明

階層の一番上の Transform

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

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void OnCollisionEnter(Collision collision) { if (collision.transform.root != transform.root) print("The colliding objects are not in the same hierarchy"); } }