private void OnEnable()
        {
            if (m_gridTexture == null)
            {
                m_gridTexture = Resources.Load <Texture>("BevTree/EditorGUI/background");
            }

            if (m_graph == null)
            {
                m_graph = BTEditorGraph.Create();
            }
            if (m_canvas == null)
            {
                m_canvas = new BTEditorCanvas();
                BTEditorCanvas.Current = m_canvas;
            }
            if (m_hotkeyHandler == null)
            {
                m_hotkeyHandler = new BTEditorHotKeyHandler(m_graph);
            }
            if (m_grid == null)
            {
                m_grid = new BTEditorGrid(m_gridTexture);
            }
            if (m_navigationHistory == null)
            {
                m_navigationHistory = new BTNavigationHistory();
            }

            ReloadBehaviourTree();
            m_isDisposed        = false;
            m_canvas.OnRepaint += OnRepaint;
            EditorApplication.playmodeStateChanged += HandlePlayModeChanged;

            // debugging
            Selection.selectionChanged += delegate { SetupBTDebugging(); };
        }