コード例 #1
0
        /// <summary>
        /// Loads the level async.
        /// </summary>
        /// <param name="sceneName">Scene name.</param>
        /// <param name="onLoaded">On loaded.</param>
        /// <param name="isAdditive">If set to <c>true</c> is additive.</param>
        public static void LoadLevelAsync(string sceneName, OnLoadDelegate onLoaded = null, bool isAdditive = false)
        {
            if (AddScene(sceneName, onLoaded))
            {
#if UNITY_5_3_OR_NEWER
                if (isAdditive)
                {
                    SceneManagement.SceneManager.LoadSceneAsync(sceneName, SceneManagement.LoadSceneMode.Additive);
                }
                else
                {
                    SceneManagement.SceneManager.LoadSceneAsync(sceneName);
                }
#else
                if (isAdditive)
                {
                    Application.LoadLevelAdditiveAsync(sceneName);
                }
                else
                {
                    Application.LoadLevelAsync(sceneName);
                }
#endif
            }
        }
コード例 #2
0
        private static bool AddScene(string sceneName, OnLoadDelegate onLoaded)
        {
            if (onLoadeds.ContainsKey(sceneName))
            {
                return(false);
            }

            onLoadeds.Add(sceneName, onLoaded);
            return(true);
        }