diff --git a/Source/Editor/Modules/PrefabsModule.cs b/Source/Editor/Modules/PrefabsModule.cs
index b33da20df..eab8d9e79 100644
--- a/Source/Editor/Modules/PrefabsModule.cs
+++ b/Source/Editor/Modules/PrefabsModule.cs
@@ -1,6 +1,7 @@
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
using System;
+using System.Collections.Generic;
using System.Linq;
using FlaxEditor.Actions;
using FlaxEditor.Content;
@@ -49,8 +50,20 @@ namespace FlaxEditor.Modules
///
public void CreatePrefab()
{
- // Check selection
- var selection = Editor.SceneEditing.Selection;
+ CreatePrefab(Editor.SceneEditing.Selection);
+ }
+
+ ///
+ /// Starts the creating prefab for the selected actor by showing the new item creation dialog in .
+ ///
+ ///
+ /// To create prefab manually (from code) use method.
+ ///
+ /// The scene selection to use.
+ public void CreatePrefab(List selection)
+ {
+ if (selection == null)
+ selection = Editor.SceneEditing.Selection;
if (selection.Count == 1 && selection[0] is ActorNode actorNode && actorNode.CanCreatePrefab)
{
CreatePrefab(actorNode.Actor);
diff --git a/Source/Editor/Windows/Assets/PrefabWindow.Hierarchy.cs b/Source/Editor/Windows/Assets/PrefabWindow.Hierarchy.cs
index b5276edea..51e907c27 100644
--- a/Source/Editor/Windows/Assets/PrefabWindow.Hierarchy.cs
+++ b/Source/Editor/Windows/Assets/PrefabWindow.Hierarchy.cs
@@ -109,7 +109,7 @@ namespace FlaxEditor.Windows.Assets
contextMenu.AddSeparator();
- b = contextMenu.AddButton("Create Prefab", Editor.Prefabs.CreatePrefab);
+ b = contextMenu.AddButton("Create Prefab", () => Editor.Prefabs.CreatePrefab(Selection));
b.Enabled = isSingleActorSelected &&
(Selection[0] as ActorNode).CanCreatePrefab &&
Editor.Windows.ContentWin.CurrentViewFolder.CanHaveAssets;