您的位置:首页 > 移动开发 > Unity3D

unity3d 选择一个物体递归输出所有节点名字

2016-03-24 17:14 399 查看
using UnityEngine;
using UnityEditor;
using System.Collections;

public class PrintNode :  Editor{
[MenuItem("PrintNode/Print")]
public static void Print() {
GameObject obj = Selection.activeGameObject;
string str = "";
Check(obj.transform, "", ref str);
Debug.LogWarning(str);
}

static void Check(Transform tf, string gap, ref string str) {
str += gap + tf.name + "\n";
foreach (Transform item in tf) {
Check(item, gap + "   ", ref str);
}
}
}

放在Editor下
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: