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

@@ -45,6 +45,21 @@ namespace FlaxEditor.Modules.SourceCodeEditing
_checkAssembly = checkAssembly;
}
/// <summary>
/// Gets the type matching the certain Script.
/// </summary>
/// <param name="script">The content item.</param>
/// <returns>The type matching that item, or null if not found.</returns>
public ScriptType Get(Content.ScriptItem script)
{
foreach (var type in Get())
{
if (type.ContentItem == script)
return type;
}
return ScriptType.Null;
}
/// <summary>
/// Gets all the types from the all loaded assemblies (including project scripts and scripts from the plugins).
/// </summary>