Unity如何获得场景的根节点
程序员文章站
2022-04-03 16:45:59
...
GameObject uiRoot = null;
foreach (var go in scene.GetRootGameObjects())
{
Debug.LogError(go.name);
if (go.name == "you gameobject name")
{
uiRoot = go;
}
}
if (uiRoot == null)
{
EditorUtility.DisplayDialog("", "you gameobject不存在","ok");
return;
}