Weird bug about flipX being stuck

So, I have a sprite animation that sets SpriteRenderer.FlipX = true, and as expected, the animation flows flawlessly…

When the animation ends, FlipX is set back to false… there is no script call no nothing, it’s just reset.

So I tried using OnStateExit to ensure that after the animation FlipX would be set to true. After coding the calls and checking that they are called, I see that the inspector keeps showing FlipX “unchecked”, the property is set to true and the sprite appears unflipped.

Then I tried doing the same thing using animation events, same result.

After that, I tried just clicking the #@&$# checkbox, and guess what? It doesn’t work, the box isn’t greyed out, it just keeps unchecked and clicking it does not flip the sprite (with the game running or not). Clicking FlipY works perfectly…

I guess that something in mecanim is holding the FlipX property, does anyone have any idea on how to fix this? I just wanted FlipX to stay checked after the end of the animation. I am using root motion and all the other properties keep their values ok.

Sorry for necro’ing this thread but it was the first result for me after looking for a solution to the very same problem OP has.
So basically all animations in an animator override default values of properties they change even if that certain animation is not playing, so if you want to adjust a property in script that is changed in one of the animations, you have to do it in LateUpdate.

Also explained here:
https://forum.unity.com/threads/animator-locking-animated-value-even-when-current-state-has-no-curves-keys-for-that-value.440363/#post-3041664

Omfg, Thank you very much!