private static void PlaymodeStateChanged() { if (EditorApplication.isPlayingOrWillChangePlaymode) { IsolateInfo.Show(); } else { IsolateInfo.Hide(); } }
private static void PlaymodeStateChanged(PlayModeStateChange change) { if (change == PlayModeStateChange.EnteredPlayMode) { IsolateInfo.Show(); } else { IsolateInfo.Hide(); } }
private static void UpdateIsolation(List <GameObject> newItems) { if (!newItems.Any()) { return; } Undo.RecordObject(IsolateInfo.Instance, "Isolate"); Undo.RecordObjects(IsolateInfo.Instance.HiddenObjects.Cast <Object>().ToArray(), "Isolate"); IsolateInfo.Show(); IsolateInfo.Instance.FocusObjects = IsolateInfo.Instance.FocusObjects.Concat(newItems).Distinct().ToList(); var newHiddenObjects = GetAllGameObjectsToHide(); Undo.RecordObjects(newHiddenObjects.Except(IsolateInfo.Instance.HiddenObjects).Cast <Object>().ToArray(), "Isolate"); IsolateInfo.Instance.HiddenObjects = newHiddenObjects; IsolateInfo.Hide(); }
private static void StartIsolation() { if (IsolateInfo.Instance) { Debug.LogWarning("Isolationist: Found previous isolation info. This shouldn't happen. Ending the previous isolation anyway."); EndIsolation(); } if (EditorApplication.isPlayingOrWillChangePlaymode) { Debug.LogWarning("Isolationist: Can't isolate while playing. It'll break stuff!"); return; } // Create new IsolateInfo object. var container = new GameObject("IsolationInfo") { hideFlags = HideFlags.HideInHierarchy }; Undo.RegisterCreatedObjectUndo(container, "Isolate"); IsolateInfo.Instance = container.AddComponent <IsolateInfo>(); var focusList = IsolateInfo.Instance.FocusObjects = Selection.gameObjects.ToList(); if (!_hideLights) { _lightTypeList.ForEach(t => focusList.AddRange(Object.FindObjectsOfType(t).Select <Object, GameObject>(ObjectToGO))); } if (!_hideCameras) { _cameraTypeList.ForEach(t => focusList.AddRange(Object.FindObjectsOfType(t).Select <Object, GameObject>(ObjectToGO))); } IsolateInfo.Instance.HiddenObjects = GetAllGameObjectsToHide(); if (!IsolateInfo.Instance.HiddenObjects.Any()) { Object.DestroyImmediate(container); Debug.LogWarning("Isolationist: Nothing to isolate."); return; } Undo.RecordObjects(IsolateInfo.Instance.HiddenObjects.Cast <Object>().ToArray(), "Isolate"); IsolateInfo.Hide(); }