From 5bafe42317bcb337c19affdf594fd09b94a1e211 Mon Sep 17 00:00:00 2001 From: Keenan Woodall Date: Tue, 5 Feb 2019 13:34:56 -0600 Subject: [PATCH] Made the PathEditor queue another update loop whenever scene or inspector controls are changed. This will let external scripts react to changes in their Update loop if they have the [ExecuteAlways] or [ExecuteInEditMode] attributes added to their script. --- PathCreator/Core/Editor/PathEditor.cs | 54 ++++++++++++++++----------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/PathCreator/Core/Editor/PathEditor.cs b/PathCreator/Core/Editor/PathEditor.cs index e7b545d..5d8954b 100644 --- a/PathCreator/Core/Editor/PathEditor.cs +++ b/PathCreator/Core/Editor/PathEditor.cs @@ -112,7 +112,6 @@ public override void OnInspectorGUI() void DrawBezierPathInspector() { - using (var check = new EditorGUI.ChangeCheckScope()) { // Path options: @@ -177,6 +176,7 @@ void DrawBezierPathInspector() if (check.changed) { SceneView.RepaintAll(); + EditorApplication.QueuePlayerLoopUpdate (); } } } @@ -196,7 +196,8 @@ void DrawVertexPathInspector() { data.VertexPathSettingsChanged(); SceneView.RepaintAll(); - } + EditorApplication.QueuePlayerLoopUpdate (); + } } } @@ -211,6 +212,7 @@ void DrawVertexPathInspector() if (check.changed) { SceneView.RepaintAll(); + EditorApplication.QueuePlayerLoopUpdate (); } } DrawGlobalDisplaySettingsInspector(); @@ -231,7 +233,7 @@ void DrawGlobalDisplaySettingsInspector() { UpdateGlobalDisplaySettings(); SceneView.RepaintAll(); - } + } } } @@ -241,25 +243,33 @@ void DrawGlobalDisplaySettingsInspector() void OnSceneGUI() { - handlesStartCol = Handles.color; - switch (data.tabIndex) - { - case bezierPathTab: - ProcessBezierPathInput(Event.current); - DrawBezierPathSceneEditor(); - break; - case vertexPathTab: - DrawVertexPathSceneEditor(); - break; - } - - - // Don't allow clicking over empty space to deselect the object - if (Event.current.type == EventType.Layout) - { - HandleUtility.AddDefaultControl(0); - } - } + using (var check = new EditorGUI.ChangeCheckScope ()) + { + handlesStartCol = Handles.color; + switch (data.tabIndex) + { + case bezierPathTab: + ProcessBezierPathInput (Event.current); + DrawBezierPathSceneEditor (); + break; + case vertexPathTab: + DrawVertexPathSceneEditor (); + break; + } + + + // Don't allow clicking over empty space to deselect the object + if (Event.current.type == EventType.Layout) + { + HandleUtility.AddDefaultControl (0); + } + + if (check.changed) + { + EditorApplication.QueuePlayerLoopUpdate (); + } + } + } void DrawVertexPathSceneEditor() {