Now that our Dropdown looks the way we want it and is functioning properly, we can access the player's selection with code. We'll use the player's selection to update the player character image in the top-left corner of the screen.
To swap the player character image with the selection from the Dropdown, complete the following steps:
- Create a new C# script in your Assets/Scripts folder named PlayerCharacterSwap.cs.
- For us to access UI variable types, add the UnityEngine.UI namespace to the top of the script with the following line:
using UnityEngine.UI;
- We only need two variables, one to represent the Image that will be swapped with the selection from the Dropdown menu and one to represent ...