I have a pretty simple animation controller for 2D top-down movement. I’ve uploaded a project with just the animation files in it here:
https://www.dropbox.com/s/l650mwhqdhcazyw/2d%20animation%20controller.zip?dl=0
I have two problems I can’t figure out:
1) Blend tree playing two animations at the same time
There’s a blend tree for idle and walking animations:
With this blend tree, there’s a problem when I move my character diagonally. For example if I move down and right, it plays the “down” animation, but twice as fast as normal. In the blend tree, it lights up two points with equal weighting:
The problem seems to be that it’s trying to play two animations at the same time, or blend them together. For 2D sprite animation, that’s not what I want at all. I’d want it to only ever be playing one animation, instead of getting stuck between two of them.
How do I prevent the blend tree from playing two animations at the same time?
2) Animator hijacks the flipx property
In the project, I made three variations of the same player character.
Left is the original, middle and right are variations.
The middle and right have a blend tree setup that removes the “left” nodes, instead using the right animations. The player movement class for these is modified to activate the sprite renderer flipx function when the input is negative. This way, I don’t have a duplicate animation for my character. That works fine for the middle one.
For the rightmost version, I made one more change. I change the walk down animation to control the flipx property so that it mirrors itself as part of the animation.
The animation itself plays fine, but the code changing the flipx property doesn’t work at all. If I try to click the flipx box in the inspector, nothing happens unless I disable the object’s Animator, or modify the animation to not use flipx.
There are going to be many situations where I’ll want to control the flipx in some animations, not use it at all for most, and control it using code for others, all within the same character. Why is having a single animation using that property hijacking it, and how can I prevent it from doing this?