Optimize C# types searching with typename
This commit is contained in:
@@ -233,18 +233,7 @@ namespace FlaxEditor.Scripting
|
||||
{
|
||||
if (string.IsNullOrEmpty(typeName))
|
||||
return null;
|
||||
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||
for (int i = 0; i < assemblies.Length; i++)
|
||||
{
|
||||
var assembly = assemblies[i];
|
||||
if (assembly != null)
|
||||
{
|
||||
var type = assembly.GetType(typeName);
|
||||
if (type != null)
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return Type.GetType(typeName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -258,18 +247,10 @@ namespace FlaxEditor.Scripting
|
||||
return ScriptType.Null;
|
||||
|
||||
// C#/C++ types
|
||||
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||
for (int i = 0; i < assemblies.Length; i++)
|
||||
{
|
||||
var assembly = assemblies[i];
|
||||
if (assembly != null)
|
||||
{
|
||||
var type = assembly.GetType(typeName);
|
||||
if (type != null)
|
||||
{
|
||||
return new ScriptType(type);
|
||||
}
|
||||
}
|
||||
var type = Type.GetType(typeName);
|
||||
if (type != null)
|
||||
return new ScriptType(type);
|
||||
}
|
||||
|
||||
// Custom types
|
||||
@@ -277,9 +258,7 @@ namespace FlaxEditor.Scripting
|
||||
{
|
||||
var type = customTypesInfo.GetType(typeName);
|
||||
if (type)
|
||||
{
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
return ScriptType.Null;
|
||||
|
||||
Reference in New Issue
Block a user