diff --git a/Unity3D/PocoManager.cs b/Unity3D/PocoManager.cs index eb532ed..d62937f 100644 --- a/Unity3D/PocoManager.cs +++ b/Unity3D/PocoManager.cs @@ -36,16 +36,22 @@ class RPC : Attribute { } - #if UNITY_EDITOR +#if UNITY_EDITOR private void OnValidate() { if (!nodeProvider) { - string[] nodeFactories = UnityEditor.AssetDatabase.FindAssets("t:UnityNodeProvider"); - if (nodeFactories.Length > 0) + UnityNodeProvider otherNodeProvider = null; + foreach (var nodeFactoryAssetGuid in UnityEditor.AssetDatabase.FindAssets("t:UnityNodeProvider")) { - var nodeFactoryAssetPath = UnityEditor.AssetDatabase.GUIDToAssetPath(nodeFactories[0]); - nodeProvider = UnityEditor.AssetDatabase.LoadAssetAtPath(nodeFactoryAssetPath); + var nodeFactoryAssetPath = UnityEditor.AssetDatabase.GUIDToAssetPath(nodeFactoryAssetGuid); + otherNodeProvider = UnityEditor.AssetDatabase.LoadAssetAtPath(nodeFactoryAssetPath); + if (otherNodeProvider) break; + } + + if (otherNodeProvider) + { + nodeProvider = otherNodeProvider; } else { @@ -53,7 +59,7 @@ private void OnValidate() } } } - #endif +#endif void Awake() {