I am making a simple 2D shooter.
I have my character's body and head as different objects, as I want him to look up/down regardless of the movement. So, I basically use the following script:
public class PlayerHead : MonoBehaviour
{
public static PlayerHead instance;
public SpriteRenderer theSR;
public Sprite netural, down, up;
private void Start()
{
instance = this;
}
public void Up()
{
theSR.sprite = up;
}
public void Down()
{
theSR.sprite = down;
}
public void Netural()
{
theSR.sprite = netural;
}
}
However, the head is also used in the player animations:
This is because head must move with the body during the idle animation (breathing and moving up&down slowly).
I suspect that because of this animation, the sprite of the head is somehow fixed. It does not change in runtime even though I change it manually inside Unity.
How can I make the Animator let me change the sprite?
