A bit of explanation about the setup we have, this character is meant to be able to face in 8 directions with their torso separate from their legs for aiming. 4 of the directions are mirrored, so rather than draw and animate them again we set the x scale of the appropriate bones to -1 to flip them.
The issue though is that the when we flip the torso the IK control bone ends up pointing in the wrong direction like so:
If I use the Skeleton Utility component during runtime though I can select the control bone and see that it's not actually pointing the wrong direction, the red right arrow matches my input it's just that the IK control bone is pointing in the opposite direction.
Here's what I've tried so far:
I did some poking around and stumbled upon another post that mentioned bone inheritance, so I thought that maybe since the IK control bone was under the torso that was being flipped that was affecting things, but disabling the scale inheritance on the control bone didn't do anything.
My next idea was to also flip my input values, and it kind of worked, but sometimes when flipping it flickers for a frame showing the IK with un-flipped input values.
At this point I felt that I had maybe gone too far in the wrong direction since having to flip the input was kind of weird. So I did some more thinking and and looking around and thought that it might be due to the animations. Since the IK control bone was also keyed for some things it would make sense if maybe that was what was causing things right? But removing all the keyframes from the animations that used the control bone didn't do anything either.
I also tried adjusting the scale of the entire unity object when flipping, and that actually worked, but because the legs and torso have to be able to flip separately it meant I couldn't really use it as a solution.
Now I'm thinking that maybe it's something with the way I'm setting the rotation of the IK control bone, or the way that flipping is handled. Both the flipping and setting the IK control rotation are done on the skeleton's UpdateLocal, but as far as I know that should be correct?
Honestly at this point I'm kind of stumped and any ideas would be great. I normally work on the Unity side of things, so apologies if there's something obvious I'm missing in regards to rig or how things should be set up.