Пример #1
0
        static bool TryGetOrCreateSceneIDMapFor(Scene scene, out SceneObjectIDMapSceneAsset map)
        {
            if (!scene.isLoaded)
            {
                map = default;
                return(false);
            }

            if (!TryGetSceneIDMapFor(scene, out map))
            {
                map = CreateSceneIDMapFor(scene);
            }

            return(true);
        }
Пример #2
0
        static bool TryGetSceneIDMapFor(Scene scene, out SceneObjectIDMapSceneAsset map)
        {
            if (!scene.isLoaded)
            {
                map = default;
                return(false);
            }

            var roots = scene.GetRootGameObjects();

            for (int i = 0; i < roots.Length; ++i)
            {
                if (roots[i].name == SceneObjectIDMapSceneAsset.k_GameObjectName &&
                    (map = roots[i].GetComponent <SceneObjectIDMapSceneAsset>()) != null &&
                    !map.Equals(null))
                {
                    return(true);
                }
            }
            map = null;
            return(false);
        }