Hello,
My games hero is supposed to have several animations and 1 state as idle. The problem is that after any animation played, the heroe
s image goes back to default, but I need it to be the last frame of animation. I tried to set it in runtime like
public Sprite RightBottomImage;
...
spriteRenderer.sprite = RightBottomImage;
But it gave to result.
Any thoughts?
An idea is that the animation needs work. I’m not criticizing, but animations usually work unless there is a glitch in the animation. Possibly trying to slightly change the code or looking for syntax errors will help you fix the animation.
Any solutions? I have the same problem.
The Animator will override the sprite (or any other parameter) set in the inspector or any sprite set in code. So I don’t think you can use code to change the sprite while the Animator has control.
Can you try zooming out on the animation timeline to make sure there is not an extra keyframe at the end which changes the sprite back to default? I’ve noticed that Unity will often add an extra keyframe at the end whenever I add a new parameter to the Animator. I’m not sure why.