Hi, I’m having a problem trying to change a sprite. This is my code:
void Update()
{
if(changeSprite) {
spriteRenderer = GetComponent();
GetComponent<SpriteRenderer>().sprite = newSprite;
print(GetComponent<SpriteRenderer>().sprite);
changeSprite = false;
StartCoroutine(ExecuteAfterTime());
}
}
With print(GetComponent().sprite) I’ve seen that the sprite’s name really corresponds to the correct sprite after change. Nevertheless, my character keeps with the same appearance. The script is correctly attached to the character (Other functionalities work). There’s an image attached to the question that show the inspector menu of my character.
Thank u in advance.