Changing Sprites
Nov 17, 2021
Let’s have the sprites update when the player is moving left and right like this:
The only script we will need to update will be Player.cs.
First, we need a reference to the other sprites (serialized) and to the SpriteRenderer itself:
Now let’s fill that SpriteRenderer reference:
And finally, we’re ready to add the logic:
That’s all it takes.