Transform.Find()

Posted ly570

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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);


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

以上是关于Transform.Find()的主要内容,如果未能解决你的问题,请参考以下文章

unity3D中GameObject.Find()Transform.Find查找隐藏对象分析

Transform.Find()

Unity Gameobject Transform

小白_Unity引擎_访问组件--GameObject.Find()和transform.Find();

Unity 自动生成组件索引类工具

100个 Unity小知识点 | Unity两种获取游戏对象的方法,GameObject.Find 和 Transform.Find区别