From 8e364d83b47f70150e1d7095d98670f27b8fa5e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8C=80=EC=9B=90?= Date: Mon, 17 Dec 2018 20:07:40 +0900 Subject: [PATCH] fix assembly load exception. --- .../Editor/ScriptableObjectFactory.cs | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Assets/Plugins/ScriptableObjectFactory/Editor/ScriptableObjectFactory.cs b/Assets/Plugins/ScriptableObjectFactory/Editor/ScriptableObjectFactory.cs index 3408eaf..89748ac 100644 --- a/Assets/Plugins/ScriptableObjectFactory/Editor/ScriptableObjectFactory.cs +++ b/Assets/Plugins/ScriptableObjectFactory/Editor/ScriptableObjectFactory.cs @@ -18,21 +18,22 @@ public static void CreateScriptableObjectFactoryWindow() public static void CreateScriptableObjectFactoryWindow(bool getAllAssemblies) { - List allScriptableObjectTypes; + var allScriptableObjectTypes = new List(); - try + var assemblies = getAllAssemblies ? GetAllAssemblies() : GetCSharpAssembly(); + foreach (var assembly in assemblies) { - var assemblies = getAllAssemblies ? GetAllAssemblies() : GetCSharpAssembly(); - - allScriptableObjectTypes = new List(from assembly in assemblies - from type in assembly.GetTypes() - where type.IsSubclassOf(typeof(ScriptableObject)) - select type); - } - catch (Exception e) - { - Debug.LogError("Error while opening scriptable object window: " + e.Message); - allScriptableObjectTypes = new List(); + try + { + allScriptableObjectTypes.AddRange(from type in assembly.GetTypes() + where type.IsSubclassOf(typeof(ScriptableObject)) + select type); + } + catch (Exception e) + { + Debug.LogError("Error while opening scriptable object window: " + + "assembly=" + assembly.FullName + "\n" + e.Message); + } } ScriptableObjectWindow.Init(allScriptableObjectTypes.ToArray(), getAllAssemblies);