private void OnSceneUnloading(Scene scene, Guid sceneId) { // Find scene tree node var node = Root.FindChildActor(scene); if (node != null) { Editor.Log($"Cleanup graph for scene \'{scene.Name}\'"); // Cleanup var selection = Editor.SceneEditing.Selection; var hasSceneSelection = false; for (int i = 0; i < selection.Count; i++) { if (selection[i].ParentScene == node) { hasSceneSelection = true; break; } } if (hasSceneSelection) { var newSelection = new List <SceneGraphNode>(); for (int i = 0; i < selection.Count; i++) { if (selection[i].ParentScene != node) { newSelection.Add(selection[i]); } } Editor.SceneEditing.Select(newSelection); } node.Dispose(); } }
private void OnSceneUnloading(Scene scene, Guid sceneId) { // Find scene tree node var node = Root.FindChildActor(scene); if (node != null) { Editor.Log($"Cleanup graph for scene \'{scene.Name}\'"); // Cleanup node.Dispose(); } }