I have a menu where the player gets to choose which team and kit he will use to play. However I don't really know how to change the sprite each time the left or right arrows are pressed. I already have the sprites for each team, league and kit the only thing I am missing is the way to arrange it via script. Thanks.
2 Answers
\$\begingroup\$
\$\endgroup\$
You can store all sprites in a array and have a index for selected team for example something like this:
List<Sprite> Slist;
int Index = 0;
if(user press next)
flagObject.GetComponent<SpriteRenderer>().sprite = Slist[Index++];
if(user press previous)
flagObject.GetComponent<SpriteRenderer>().sprite = Slist[Index--];
Although you should check for Index to not going out of bound.
\$\begingroup\$
\$\endgroup\$
You can do that using Unity UI's Scroll rect. Trick is to use a mask so that only one element can be displayed at a time. Refer Scroll Rect