void OnEnable() { splines = new SplineComputer[targets.Length]; for (int i = 0; i < splines.Length; i++) { splines[i] = (SplineComputer)targets[i]; splines[i].EditorAwake(); if (splines[i].alwaysDraw) { DSSplineDrawer.RegisterComputer(splines[i]); } } spline = splines[0]; InitializeSplineEditor(); InitializeComputerEditor(); debugEditor = new SplineDebugEditor(spline); debugEditor.undoHandler += RecordUndo; debugEditor.repaintHandler += OnRepaint; triggersEditor = new SplineTriggersEditor(spline); triggersEditor.undoHandler += RecordUndo; triggersEditor.repaintHandler += OnRepaint; hold = false; #if UNITY_2019_1_OR_NEWER SceneView.beforeSceneGui += BeforeSceneGUI; #else SceneView.onSceneGUIDelegate += BeforeSceneGUI; #endif Undo.undoRedoPerformed += UndoRedoPerformed; }
void OnEnable() { EnableToolbar(); splines = new SplineComputer[targets.Length]; for (int i = 0; i < splines.Length; i++) { splines[i] = (SplineComputer)targets[i]; splines[i].EditorAwake(); } spline = splines[0]; InitializeSplineEditor(); InitializeComputerEditor(); debugEditor = new SplineDebugEditor(spline); debugEditor.undoHandler += RecordUndo; debugEditor.repaintHandler += OnRepaint; triggersEditor = new SplineTriggersEditor(spline); triggersEditor.undoHandler += RecordUndo; triggersEditor.repaintHandler += OnRepaint; hold = false; SceneView.beforeSceneGui += BeforeSceneGUI; Undo.undoRedoPerformed += UndoRedoPerformed; }