diff --git a/Source/Editor/SceneGraph/Actors/SceneNode.cs b/Source/Editor/SceneGraph/Actors/SceneNode.cs
index 35c71bf02..2846715fc 100644
--- a/Source/Editor/SceneGraph/Actors/SceneNode.cs
+++ b/Source/Editor/SceneGraph/Actors/SceneNode.cs
@@ -1,5 +1,7 @@
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
+using System.Net;
+using FlaxEditor.GUI.ContextMenu;
using FlaxEditor.SceneGraph.GUI;
using FlaxEngine;
@@ -17,9 +19,6 @@ namespace FlaxEditor.SceneGraph.Actors
///
/// Gets or sets a value indicating whether this scene is edited.
///
- ///
- /// true if this scene is edited; otherwise, false.
- ///
public bool IsEdited
{
get => _isEdited;
@@ -28,7 +27,6 @@ namespace FlaxEditor.SceneGraph.Actors
if (_isEdited != value)
{
_isEdited = value;
-
_treeNode.UpdateText();
}
}
@@ -37,9 +35,6 @@ namespace FlaxEditor.SceneGraph.Actors
///
/// Gets the scene.
///
- ///
- /// The scene.
- ///
public Scene Scene => _actor as Scene;
///
@@ -68,5 +63,25 @@ namespace FlaxEditor.SceneGraph.Actors
///
public override SceneNode ParentScene => this;
+
+ ///
+ public override void OnContextMenu(ContextMenu contextMenu)
+ {
+ contextMenu.AddSeparator();
+ contextMenu.AddButton("Save scene", OnSave).LinkTooltip("Saves this scene.").Enabled = IsEdited && !Editor.IsPlayMode;
+ contextMenu.AddButton("Unload scene", OnUnload).LinkTooltip("Unloads this scene.").Enabled = Editor.Instance.StateMachine.CurrentState.CanChangeScene;
+
+ base.OnContextMenu(contextMenu);
+ }
+
+ private void OnSave()
+ {
+ Editor.Instance.Scene.SaveScene(this);
+ }
+
+ private void OnUnload()
+ {
+ Editor.Instance.Scene.CloseScene(Scene);
+ }
}
}
diff --git a/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs b/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs
index 50187ed3f..fe88a13a1 100644
--- a/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs
+++ b/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs
@@ -104,12 +104,11 @@ namespace FlaxEditor.Windows
Editor.Windows.ContentWin.CurrentViewFolder.CanHaveAssets;
bool hasPrefabLink = canEditScene && isSingleActorSelected && (Editor.SceneEditing.Selection[0] as ActorNode).HasPrefabLink;
-
- b = contextMenu.AddButton("Select Prefab", Editor.Prefabs.SelectPrefab);
- b.Enabled = hasPrefabLink;
-
- b = contextMenu.AddButton("Break Prefab Link", Editor.Prefabs.BreakLinks);
- b.Enabled = hasPrefabLink;
+ if (hasPrefabLink)
+ {
+ contextMenu.AddButton("Select Prefab", Editor.Prefabs.SelectPrefab);
+ contextMenu.AddButton("Break Prefab Link", Editor.Prefabs.BreakLinks);
+ }
// Spawning actors options