Simplify code in #2202 for script type searching

This commit is contained in:
Wojtek Figat
2024-02-06 11:09:08 +01:00
parent 741682b5e7
commit b2d0afd4ef
7 changed files with 31 additions and 43 deletions

View File

@@ -203,12 +203,9 @@ namespace FlaxEditor.Viewport
private void Spawn(ScriptItem item, SceneGraphNode hit, ref Float2 location, ref Vector3 hitLocation, ref Vector3 hitNormal)
{
// Find actors with the same content item and spawn them.
foreach (var actorType in Editor.Instance.CodeEditing.Actors.Get())
var actorType = Editor.Instance.CodeEditing.Actors.Get(item);
if (actorType != ScriptType.Null)
{
if (actorType.ContentItem != item)
continue;
Spawn(actorType, hit, ref location, ref hitLocation, ref hitNormal);
}
}