Esempio n. 1
0
        private void EnsureGUI()
        {
            if (editor == null)
            {
                OpenWindow();
            }

            if (nodeCanvas == null)
            {
                nodeCanvas = new NodeCanvas(editor.GetCanvasRect());
            }

            if (nodeInspector == null)
            {
                nodeInspector = new NodeInspector(editor.GetInspectorRect(), nodeCanvas);
            }
        }
Esempio n. 2
0
        public static void OpenWindow()
        {
            editor                = GetWindow <BehaviourEditorWindow>();
            editor.minSize        = new Vector2(600, 300);
            editor.titleContent   = new GUIContent("Behaviour Editor");
            editor._curWindowSize = editor.position.size;
            editor._menuRect      = editor.GetMenuRect();

            nodeCanvas    = new NodeCanvas(editor.GetCanvasRect());
            nodeInspector = new NodeInspector(editor.GetInspectorRect(), nodeCanvas);

            Selection.selectionChanged += TryLoadSelectedAsset;

            NodeFactory.FetchNodes();
            NodePanelFactory.FetchCustomPanels();
            CustomFieldDrawerManager.FetchCustomFieldDrawers();

            // tries to load the selected asset if it is a behaviour tree when the window is open
            // and also when the assembly is reloaded
            TryLoadSelectedAsset();
        }