Transform.Find()

Code demonstrates:

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

}
}

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

Guess you like

Origin www.cnblogs.com/ly570/p/11278020.html