Unity通过父物体找到所有子物体

来源:互联网 发布:贝斯内录用什么软件 编辑:程序博客网 时间:2024/05/20 06:41
sing UnityEngine;
using System.Collections;


public class GameSchedule : MonoBehaviour {

    private GameObject UI;
    void Awake()
    {
        UI = GameObject.Find("UIRoot");
    }
void Start () 
    {
        foreach (Transform ss in UI.transform)//找到UIRoot下面的所有子物体,将他们设置为隐藏状态;
        {
            ss.gameObject.SetActive(false);
     }
}
0 0
原创粉丝点击