diff --git a/Assets/com.alelievr.NodeGraphProcessor/Editor/Views/BaseGraphView.cs b/Assets/com.alelievr.NodeGraphProcessor/Editor/Views/BaseGraphView.cs index 7940f6ee..7c2c3dd4 100644 --- a/Assets/com.alelievr.NodeGraphProcessor/Editor/Views/BaseGraphView.cs +++ b/Assets/com.alelievr.NodeGraphProcessor/Editor/Views/BaseGraphView.cs @@ -133,7 +133,15 @@ protected NodeInspectorObject nodeInspector public SerializedObject serializedGraph { get; private set; } - Dictionary nodeTypePerCreateAssetType = new Dictionary(); + SortedDictionary nodeTypePerCreateAssetType = new SortedDictionary( + // Sort by order of inheritances, so that the descendant type is prioritized over the ascendant type. + // Otherwise, sort by name. + Comparer.Create((Type x, Type y) => { + if (x.IsSubclassOf(y)) return -1; + else if (y.IsSubclassOf(x)) return 1; + else return x.FullName.CompareTo(y.FullName); + }) + ); public BaseGraphView(EditorWindow window) {