// Creates an editor node.
        private BonsaiNode CreateEditorNode(Type behaviourType)
        {
            var prop = BonsaiEditor.GetNodeTypeProperties(behaviourType);
            var tex  = BonsaiPreferences.Texture(prop.texName);
            var node = AddEditorNode(prop.hasOutput, tex);

            return(node);
        }
        private static SettingsProvider CreateBehaviorTreeSettingsProvider()
        {
            // First parameter is the path in the Settings window.
            // Second parameter is the scope of this setting: it only appears in the Project Settings window.
            var provider = new SettingsProvider("Preferences/BehaviorTree", SettingsScope.User)
            {
                // By default the last token of the path is used as display name if no label is provided.
                label = "Behavior Tree",
                // Create the SettingsProvider and initialize its drawing (IMGUI) function in place:
                guiHandler = (searchContext) =>
                {
                    var settings = BonsaiPreferences.GetSerializedSettings();
                    var editor   = Editor.CreateEditor(BonsaiPreferences.Instance);
                    editor.OnInspectorGUI();
                    //EditorGUILayout.PropertyField(settings.FindProperty("m_Number"), new GUIContent("My Number"));
                    //EditorGUILayout.PropertyField(settings.FindProperty("m_SomeString"), new GUIContent("My String"));
                },

                // Populate the search keywords to enable smart search filtering and label highlighting:
                keywords = new HashSet <string>(new[] { "Behavior Tree" })
            };

            return(provider);
        }
Example #3
0
        private static Texture NodeIcon(Type behaviourType)
        {
            var prop = BonsaiEditor.GetNodeTypeProperties(behaviourType);

            return(BonsaiPreferences.Texture(prop.texName));
        }
 public static SerializedObject GetSerializedSettings()
 {
     instance = LoadDefaultPreferences();
     return(new SerializedObject(Instance));
 }