Home>

I want to change sprites from SpriteRenderer while Animator is on in Unity
] (9b8b86b57384f8d70c9c9915a77f4093.png)
Sprites cannot be modified while this animation is running.
As a beginner, you may not have the information you need to resolve it. I would appreciate it if you could let me know if there is any information that is not enough to solve.

Error message
None
Corresponding source code
Source code
public class FirstBall: BattleManager
{
public Sprite sprite_b;
public SpriteRenderer enemtrainerRend;
void Update () {
        enemtrainerRend.sprite = sprite_b;
        Debug.Log ($"Rendara 2 {enemtrainerRend.sprite.name}");
}
}
What I tried

With Animator turned off, I was able to change sprites from SpriteRenderer.
In Debug.Log in the Update () statement, the name of Sprite_b was always mentioned, but it was always the default image on the screen.

Supplementary information (FW/tool version, etc.)

The version is 2020.1.6f1.