diff --git a/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs b/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs
index 09b0e3a1f..1561e6245 100644
--- a/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs
+++ b/Source/Editor/CustomEditors/Dedicated/ActorEditor.cs
@@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using FlaxEditor.Actions;
using FlaxEditor.CustomEditors.Editors;
using FlaxEditor.CustomEditors.Elements;
@@ -9,6 +10,8 @@ using FlaxEditor.GUI;
using FlaxEditor.GUI.ContextMenu;
using FlaxEditor.GUI.Tree;
using FlaxEditor.Scripting;
+using FlaxEditor.Windows;
+using FlaxEditor.Windows.Assets;
using FlaxEngine;
using FlaxEngine.GUI;
using FlaxEngine.Json;
@@ -111,6 +114,38 @@ namespace FlaxEditor.CustomEditors.Dedicated
var actor = (Actor)Values[0];
var scriptType = TypeUtils.GetType(actor.TypeName);
var item = scriptType.ContentItem;
+ if (Presenter.Owner is PropertiesWindow propertiesWindow)
+ {
+ var lockButton = cm.AddButton(propertiesWindow.LockObjects ? "Unlock" : "Lock");
+ lockButton.ButtonClicked += button =>
+ {
+ propertiesWindow.LockObjects = !propertiesWindow.LockObjects;
+
+ // Reselect current selection
+ if (!propertiesWindow.LockObjects && Editor.Instance.SceneEditing.SelectionCount > 0)
+ {
+ var cachedSelection = Editor.Instance.SceneEditing.Selection.ToArray();
+ Editor.Instance.SceneEditing.Select(null);
+ Editor.Instance.SceneEditing.Select(cachedSelection);
+ }
+ };
+ }
+ else if (Presenter.Owner is PrefabWindow prefabWindow)
+ {
+ var lockButton = cm.AddButton(prefabWindow.LockSelectedObjects ? "Unlock" : "Lock");
+ lockButton.ButtonClicked += button =>
+ {
+ prefabWindow.LockSelectedObjects = !prefabWindow.LockSelectedObjects;
+
+ // Reselect current selection
+ if (!prefabWindow.LockSelectedObjects && prefabWindow.Selection.Count > 0)
+ {
+ var cachedSelection = prefabWindow.Selection.ToList();
+ prefabWindow.Select(null);
+ prefabWindow.Select(cachedSelection);
+ }
+ };
+ }
cm.AddButton("Copy ID", OnClickCopyId);
cm.AddButton("Edit actor type", OnClickEditActorType).Enabled = item != null;
var showButton = cm.AddButton("Show in content window", OnClickShowActorType);
diff --git a/Source/Editor/Windows/Assets/PrefabWindow.Selection.cs b/Source/Editor/Windows/Assets/PrefabWindow.Selection.cs
index be20c176c..85dfc1595 100644
--- a/Source/Editor/Windows/Assets/PrefabWindow.Selection.cs
+++ b/Source/Editor/Windows/Assets/PrefabWindow.Selection.cs
@@ -54,6 +54,9 @@ namespace FlaxEditor.Windows.Assets
/// The selection before the change.
public void OnSelectionChanged(SceneGraphNode[] before)
{
+ if (LockSelectedObjects)
+ return;
+
Undo.AddAction(new SelectionChangeAction(before, Selection.ToArray(), OnSelectionUndo));
OnSelectionChanges();
diff --git a/Source/Editor/Windows/Assets/PrefabWindow.cs b/Source/Editor/Windows/Assets/PrefabWindow.cs
index b788821cf..36841d515 100644
--- a/Source/Editor/Windows/Assets/PrefabWindow.cs
+++ b/Source/Editor/Windows/Assets/PrefabWindow.cs
@@ -68,6 +68,11 @@ namespace FlaxEditor.Windows.Assets
///
public readonly LocalSceneGraph Graph;
+ ///
+ /// Indication of if the prefab window selection is locked on specific objects.
+ ///
+ public bool LockSelectedObjects = false;
+
///
/// Gets or sets a value indicating whether use live reloading for the prefab changes (applies prefab changes on modification by auto).
///
diff --git a/Source/Editor/Windows/PropertiesWindow.cs b/Source/Editor/Windows/PropertiesWindow.cs
index 17b269c1b..9c1cbec0d 100644
--- a/Source/Editor/Windows/PropertiesWindow.cs
+++ b/Source/Editor/Windows/PropertiesWindow.cs
@@ -37,6 +37,11 @@ namespace FlaxEditor.Windows
///
public bool UIPivotRelative = true;
+ ///
+ /// Indication of if the properties window is locked on specific objects.
+ ///
+ public bool LockObjects = false;
+
///
/// Initializes a new instance of the class.
///
@@ -62,6 +67,9 @@ namespace FlaxEditor.Windows
private void OnSelectionChanged()
{
+ if (LockObjects)
+ return;
+
// Update selected objects
// TODO: use cached collection for less memory allocations
undoRecordObjects = Editor.SceneEditing.Selection.ConvertAll(x => x.UndoRecordObject).Distinct();