diff --git a/Scripts/NodeDataCache.cs b/Scripts/NodeDataCache.cs index fa19ed0..9ec08ed 100644 --- a/Scripts/NodeDataCache.cs +++ b/Scripts/NodeDataCache.cs @@ -153,6 +153,10 @@ namespace XNode { private static void BuildCache() { portDataCache = new PortDataCache(); dynamicListPorts = new List(); + +#if UNITY_2019_2_OR_NEWER && UNITY_EDITOR + List nodeTypes = UnityEditor.TypeCache.GetTypesDerivedFrom().Where(type => !type.IsAbstract).ToList(); +#else System.Type baseType = typeof(Node); List nodeTypes = new List(); System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies(); @@ -177,6 +181,7 @@ namespace XNode { break; } } +#endif for (int i = 0; i < nodeTypes.Count; i++) { CachePorts(nodeTypes[i]);