Unity技术分享unity3D技术分享Unity教程合集

查找隐藏了root根节点的游戏物体

2016-08-23  本文已影响79人  你的头好大

```

TestDestory[] testDestorys = (TestDestory[])Resources.FindObjectsOfTypeAll(typeof(TestDestory));

foreach (TestDestory testDestory in testDestorys)

{

if (testDestory.transform.parent != null)

{

continue;

}

if (testDestory.hideFlags == HideFlags.NotEditable || testDestory.hideFlags == HideFlags.HideAndDontSave)

{

continue;

}

if (Application.isEditor)

{

string sAssetPath = AssetDatabase.GetAssetPath(testDestory.transform.root.gameObject);

if (!string.IsNullOrEmpty(sAssetPath))

{

continue;

}

}

Debug.Log(testDestory.name);

}

```

上一篇下一篇

猜你喜欢

热点阅读