【Unity3D自学记录】遍历父物体下所有子物体

using UnityEngine;
using System.Collections;

public class ResourcesLoadObj : MonoBehaviour
{
    void Start()
    {
        foreach (Transform child in gameObject.transform)
        {
            Debug.Log("所有该脚本的物体下的子物体名称:"+child.name);
        }
    }
}


猜你喜欢

转载自blog.csdn.net/hackdjh/article/details/20454341
今日推荐