|
@@ -74,6 +74,13 @@ namespace Spine.Unity.Editor {
|
|
|
targetBoneFollower = (BoneFollower)target;
|
|
|
if (targetBoneFollower.SkeletonRenderer != null)
|
|
|
targetBoneFollower.SkeletonRenderer.Initialize(false);
|
|
|
+
|
|
|
+ if (!targetBoneFollower.valid || needsReset) {
|
|
|
+ targetBoneFollower.Initialize();
|
|
|
+ targetBoneFollower.LateUpdate();
|
|
|
+ needsReset = false;
|
|
|
+ SceneView.RepaintAll();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void OnSceneGUI () {
|
|
@@ -114,7 +121,7 @@ namespace Spine.Unity.Editor {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (needsReset) {
|
|
|
+ if (needsReset && UnityEngine.Event.current.type == EventType.Layout) {
|
|
|
targetBoneFollower.Initialize();
|
|
|
targetBoneFollower.LateUpdate();
|
|
|
needsReset = false;
|
|
@@ -143,11 +150,8 @@ namespace Spine.Unity.Editor {
|
|
|
if (targetBoneFollower.valid) {
|
|
|
EditorGUI.BeginChangeCheck();
|
|
|
EditorGUILayout.PropertyField(boneName);
|
|
|
- if (EditorGUI.EndChangeCheck()) {
|
|
|
- serializedObject.ApplyModifiedProperties();
|
|
|
- needsReset = true;
|
|
|
- serializedObject.Update();
|
|
|
- }
|
|
|
+ needsReset |= EditorGUI.EndChangeCheck();
|
|
|
+
|
|
|
EditorGUILayout.PropertyField(followBoneRotation);
|
|
|
EditorGUILayout.PropertyField(followZPosition);
|
|
|
EditorGUILayout.PropertyField(followLocalScale);
|
|
@@ -169,8 +173,10 @@ namespace Spine.Unity.Editor {
|
|
|
|
|
|
var current = UnityEngine.Event.current;
|
|
|
bool wasUndo = (current.type == EventType.ValidateCommand && current.commandName == "UndoRedoPerformed");
|
|
|
- if (serializedObject.ApplyModifiedProperties() || wasUndo)
|
|
|
+ if (wasUndo)
|
|
|
targetBoneFollower.Initialize();
|
|
|
+
|
|
|
+ serializedObject.ApplyModifiedProperties();
|
|
|
}
|
|
|
}
|
|
|
|