diff --git a/Source/Editor/Scripting/TypeUtils.cs b/Source/Editor/Scripting/TypeUtils.cs index b2b71d370..cc763b9b8 100644 --- a/Source/Editor/Scripting/TypeUtils.cs +++ b/Source/Editor/Scripting/TypeUtils.cs @@ -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); } /// @@ -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; diff --git a/Source/Engine/Content/JsonAsset.cs b/Source/Engine/Content/JsonAsset.cs index 60e01d472..9b9441435 100644 --- a/Source/Engine/Content/JsonAsset.cs +++ b/Source/Engine/Content/JsonAsset.cs @@ -25,38 +25,26 @@ namespace FlaxEngine if (WaitForLoaded()) return null; - var assemblies = AppDomain.CurrentDomain.GetAssemblies(); + object obj = null; var dataTypeName = DataTypeName; - - for (int i = 0; i < assemblies.Length; i++) + var type = Type.GetType(dataTypeName); + if (type != null) { - var assembly = assemblies[i]; - if (assembly != null) + try { - var type = assembly.GetType(dataTypeName); - if (type != null) - { - object obj = null; - try - { - // Create instance - obj = Activator.CreateInstance(type); + // Create instance + obj = Activator.CreateInstance(type); - // Deserialize object - var data = Data; - JsonSerializer.Deserialize(obj, data); - } - catch (Exception ex) - { - Debug.LogException(ex); - } - - return obj; - } + // Deserialize object + var data = Data; + JsonSerializer.Deserialize(obj, data); + } + catch (Exception ex) + { + Debug.LogException(ex); } } - - return null; + return obj; } } }