浏览代码

[unity] Corrected behaviour of SkeletonGraphic edit reference rect when entering/exiting play mode. See #1640.

Harald Csaszar 2 年之前
父节点
当前提交
78302ac1d8

+ 11 - 0
spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonGraphicInspector.cs

@@ -141,9 +141,20 @@ namespace Spine.Unity.Editor {
 
 			separatorSlotNames = so.FindProperty("separatorSlotNames");
 			separatorSlotNames.isExpanded = true;
+
+			EditorApplication.playModeStateChanged += OnPlaymodeChanged;
 		}
 
 		void OnDisable () {
+			EditorApplication.playModeStateChanged -= OnPlaymodeChanged;
+			DisableEditReferenceRectMode();
+		}
+
+		void OnPlaymodeChanged (PlayModeStateChange mode) {
+			DisableEditReferenceRectMode();
+		}
+
+		void DisableEditReferenceRectMode () {
 			foreach (UnityEngine.Object c in targets) {
 				SkeletonGraphic component = (SkeletonGraphic)c;
 				component.EditReferenceRect = false;

+ 1 - 1
spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs

@@ -321,8 +321,8 @@ namespace Spine.Unity {
 
 		public virtual void Update () {
 #if UNITY_EDITOR
+			UpdateReferenceRectSizes();
 			if (!Application.isPlaying) {
-				UpdateReferenceRectSizes();
 				Update(0f);
 				return;
 			}