Transform.Find()

代码演示:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TransformFind : MonoBehaviour {

private Transform m_Transform;
private GameObject one;
private GameObject two;

void Start () {

m_Transform = gameObject.GetComponent<Transform>();
one = m_Transform.Find("D2").gameObject;
two = m_Transform.Find("D2/D3").gameObject;

Debug.Log(one.name);
Debug.Log(two.name);

}
}

--------------------- 

posted on 2019-07-31 17:49  激流勇进1  阅读(649)  评论(0编辑  收藏  举报