1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-20 09:16:01 +08:00

reduces reload time from 400ms to 7ms in our project

probably very related to project size
This commit is contained in:
Simon Rodriguez 2022-11-30 10:30:35 +01:00
parent 5641110416
commit c178040494

View File

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