void OnEnable() { if (RootLifetimeScope != null) { RootLifetimeScope.IsRoot = true; } Instance = this; }
public static void LoadInstanceFromAssetDatabase() { var guids = UnityEditor.AssetDatabase.FindAssets("t:VContainerSettings"); if (guids.Length > 0) { var path = UnityEditor.AssetDatabase.GUIDToAssetPath(guids[0]); Instance = UnityEditor.AssetDatabase.LoadAssetAtPath <VContainerSettings>(path); } }
static void EditorInitialize() { // RootLifetimeScope must be disposed before it can be resumed. UnityEditor.EditorApplication.playModeStateChanged += state => { switch (state) { case UnityEditor.PlayModeStateChange.ExitingPlayMode: if (Instance != null) { if (Instance.RootLifetimeScope != null) { Instance.RootLifetimeScope.DisposeCore(); } Instance = null; } break; } }; }