查找隐藏了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);
}
```