Пример #1
0
        /// <summary>
        /// Awake is called when the script instance is being loaded.
        /// </summary>
        void Awake()
        {
            bool isLoaded = false;

            PlatformInfo.Type type = PlatformInfo.Instance.type;
            for (int i = 0; i < SceneManager.sceneCount; i++)
            {
                Scene scene = SceneManager.GetSceneAt(i);
                if (scene.name == type.ToString())
                {
                    isLoaded = true;
                }
            }

            if (!isLoaded)
            {
                SceneManager.LoadScene(type.ToString(), LoadSceneMode.Additive);
            }

            PlatformOn[] platformOns = FindObjectsOfType <PlatformOn>();
            Debug.Log("count of plarfrom" + platformOns.Count());
            foreach (var pt in platformOns)
            {
                Debug.Log("PlatformInfo.Instance.stamp is .." + PlatformInfo.Instance.stamp.ToString());
                if (!pt.gameObject.HasComponent(PlatformInfo.Instance.stamp))
                {
                    Destroy(pt.gameObject);
                }
            }
        }
Пример #2
0
        // public Scene _scene;
        private void Awake()
        {
            bool isLoaded = false;

            PlatformInfo.Type type = PlatformInfo.Instance.type;
            Debug.Log(SceneManager.sceneCount);

            for (int i = 0; i < SceneManager.sceneCount; ++i)
            {
                Scene scene = SceneManager.GetSceneAt(i);
                if (scene.name == type.ToString())
                {
                    isLoaded = true;
                }
            }
            if (!isLoaded)
            {
                SceneManager.LoadScene(type.ToString(), LoadSceneMode.Additive);
            }
        }