オブジェクトの親、子を取得する

「オブジェクトの親、子を取得する」の編集履歴(バックアップ)一覧はこちら

オブジェクトの親、子を取得する - (2015/06/23 (火) 00:07:27) の最新版との変更点

追加された行は緑色になります。

削除された行は赤色になります。

-子を取得  transform.FindChild()ではなくtransform.Find()が正しいらしい  transform.Find()はtransformなので、GameObjectは、transform.Find().GameObjectを読む必要がある。  子どもは、親のtransformにぶら下がる。正確には、子どものtransformが、親のtransformにぶら下がっている。 GameObject childObject = gameObject.transform.Find("子要素の名前").gameObject; ↑子がいないときにエラーになる。 if( gameObject.transform.Find("子要素の名前")!=null ) { GameObject childObject = gameObject.transform.Find("子要素の名前").gameObject; } -親を取得 GameObject childObject = gameObject.transform.parent.gameObject; -Canvas内の子供を取得 GameObject.Find ("Canvas").transform.FindChild("MenuPanel").gameObject.SetActive(true);
-子を取得  transform.FindChild()ではなくtransform.Find()が正しいらしい  transform.Find()はtransformなので、GameObjectは、transform.Find().GameObjectを読む必要がある。  子どもは、親のtransformにぶら下がる。正確には、子どものtransformが、親のtransformにぶら下がっている。 GameObject childObject = gameObject.transform.Find("子要素の名前").gameObject; ↑子がいないときにエラーになる。 if( gameObject.transform.Find("子要素の名前")!=null ) { GameObject childObject = gameObject.transform.Find("子要素の名前").gameObject; } FindGameObjectsWithTag()はあるが、FindTransformsWithTag()は無いので、複数のchildを取得する方法はない? -親を取得 GameObject childObject = gameObject.transform.parent.gameObject; -Canvas内の子供を取得 GameObject.Find ("Canvas").transform.FindChild("MenuPanel").gameObject.SetActive(true);

表示オプション

横に並べて表示:
変化行の前後のみ表示: