diff --git a/spine-unity/Assets/spine-unity/BoneFollower.cs b/spine-unity/Assets/spine-unity/BoneFollower.cs
index a5a1af424..d59c88550 100644
--- a/spine-unity/Assets/spine-unity/BoneFollower.cs
+++ b/spine-unity/Assets/spine-unity/BoneFollower.cs
@@ -47,12 +47,16 @@ namespace Spine.Unity {
}
}
- /// If a bone isn't set, boneName is used to find the bone.
+ /// If a bone isn't set in code, boneName is used to find the bone.
[SpineBone(dataField: "skeletonRenderer")]
public String boneName;
public bool followZPosition = true;
public bool followBoneRotation = true;
+
+ [Tooltip("Follows the skeleton's flip state by controlling this Transform's local scale.")]
+ public bool followSkeletonFlip = false;
+
[UnityEngine.Serialization.FormerlySerializedAs("resetOnAwake")]
public bool initializeOnAwake = true;
#endregion
@@ -122,6 +126,11 @@ namespace Spine.Unity {
thisTransform.rotation = Quaternion.Euler(worldRotation.x, worldRotation.y, skeletonTransform.rotation.eulerAngles.z + bone.WorldRotationX);
}
}
+
+ if (followSkeletonFlip) {
+ float flipScaleY = bone.skeleton.flipX ^ bone.skeleton.flipY ? -1f : 1f;
+ thisTransform.localScale = new Vector3(1f, flipScaleY, 1f);
+ }
}
}
diff --git a/spine-unity/Assets/spine-unity/Editor/BoneFollowerInspector.cs b/spine-unity/Assets/spine-unity/Editor/BoneFollowerInspector.cs
index 93b6b791e..d6341be35 100644
--- a/spine-unity/Assets/spine-unity/Editor/BoneFollowerInspector.cs
+++ b/spine-unity/Assets/spine-unity/Editor/BoneFollowerInspector.cs
@@ -35,7 +35,7 @@ using UnityEngine;
namespace Spine.Unity.Editor {
[CustomEditor(typeof(BoneFollower))]
public class BoneFollowerInspector : UnityEditor.Editor {
- SerializedProperty boneName, skeletonRenderer, followZPosition, followBoneRotation;
+ SerializedProperty boneName, skeletonRenderer, followZPosition, followBoneRotation, followSkeletonFlip;
BoneFollower targetBoneFollower;
bool needsReset;
@@ -44,6 +44,7 @@ namespace Spine.Unity.Editor {
boneName = serializedObject.FindProperty("boneName");
followBoneRotation = serializedObject.FindProperty("followBoneRotation");
followZPosition = serializedObject.FindProperty("followZPosition");
+ followSkeletonFlip = serializedObject.FindProperty("followSkeletonFlip");
targetBoneFollower = (BoneFollower)target;
if (targetBoneFollower.SkeletonRenderer != null)
@@ -80,6 +81,7 @@ namespace Spine.Unity.Editor {
}
EditorGUILayout.PropertyField(followBoneRotation);
EditorGUILayout.PropertyField(followZPosition);
+ EditorGUILayout.PropertyField(followSkeletonFlip);
} else {
var boneFollowerSkeletonRenderer = targetBoneFollower.skeletonRenderer;
if (boneFollowerSkeletonRenderer == null) {