예제 #1
0
 public static SceneWrapper GetSceneWrapper(this GameObject obj)
 {
     if (obj == null)
     {
         throw new ArgumentNullException(nameof(obj));
     }
     return(SceneWrapper.GetWrapper(obj));
 }
        static SceneWrapper()
        {
            var kinds = SceneData.SceneKinds;
            var count = kinds.Count;

            wrappers         = new List <SceneWrapper>(count);
            kindWrapperDict  = new Dictionary <SceneKind, SceneWrapper>(count);
            indexWrapperDict = new Dictionary <int, SceneWrapper>(count);
            foreach (var kind in kinds)
            {
                var wrapper = new SceneWrapper(kind);
                wrappers.Add(wrapper);
                kindWrapperDict.Add(kind, wrapper);
                indexWrapperDict.Add(wrapper.BuildIndex, wrapper);
            }
            SceneManager.sceneLoaded        += SceneLoaded;
            SceneManager.sceneUnloaded      += SceneUnloaded;
            SceneManager.activeSceneChanged += ActiveSceneChanged;
        }