Unity如何获得场景的根节点

  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;
         
            }

 

你可能感兴趣的:(程序员瞎折腾,每天一点u3d)