Creating a slide shower using a discrete slider
Here, we can go further in providing additional customization for the player. In this case, we are going to implement a slide shower. The player will be able to scroll between pictures using a slider. To achieve this, we will see how to write a script to run this system. Again, we will use the events from the Slider (Script) component.
How to do it...
To begin, we need to create our slider, which will be the controller of the player, so let's right-click on the Hierarchy panel and then go to UI | Slider. Finally, rename it to SlideShowerSlider.
Then, select the slider and, in the Inspector, navigate to Add Component | New Script. Name it to SlideShowerScript and then click on Create and Add.
Now, double-click on the script in order to edit it. Like every other time when we deal with the UI, we have to add the
using UnityEngine.UI;
statement at the beginning of the script, since we are going to use some UI classes.We need two
public
variables, one...