Hey there, I have a problem with a 2D complex character rig going from Unity 5.3.6 to 5.4+.
I’ve looked around on the forums/google/answers and I see a lot of people with similar problems, but most solutions either don’t work for me or were from two years ago or more.
So, I have a parent gameobject with an animator, 2D rigidbody, 2D box collider, and 2D character controller. Then a child with the torso sprite, and nested below that the limbs, head etc. None of the limbs have colliders on any other components except their sprite renderer.
For the running animation, I rotate the body a few degrees in the Z axis to make the character lean forward. This works great, all the limbs follow along, and the parent gameobject stays perfectly level.
Then when I switch directions, the controller script flips the root gameobject’s localscale.
private void Flip()
{
m_FacingRight = !m_FacingRight;
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}
This flips the rig and the animation perfectly, but since Unity 5.4 the rotation values no longer flip with it. So when I run one way, everything is fine, but if I run the other way, the character leans way backwards.
I figured if this was a structural problem with the way I flip the rig or have it set up, it should have been present in 5.3.6 and below too, but it wasn’t, it’s a very clear difference upgrading to 5.4. Does anyone know what changed that Unity now handles this differently? Is there a workaround or should I stick with 5.3.6 for this project?
Thanks