Simplify code in #2202 for script type searching
This commit is contained in:
@@ -274,13 +274,10 @@ namespace FlaxEditor.Windows
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private static bool ValidateDragScriptItem(ScriptItem script)
|
||||
{
|
||||
var actors = Editor.Instance.CodeEditing.Actors.Get();
|
||||
if (actors.Any(x => x.ContentItem == script))
|
||||
return true;
|
||||
return false;
|
||||
return Editor.Instance.CodeEditing.Actors.Get(script) != ScriptType.Null;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -468,12 +465,9 @@ namespace FlaxEditor.Windows
|
||||
for (int i = 0; i < _dragScriptItems.Objects.Count; i++)
|
||||
{
|
||||
var item = _dragScriptItems.Objects[i];
|
||||
// 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;
|
||||
|
||||
var actor = actorType.CreateInstance() as Actor;
|
||||
if (actor == null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user