Creating a slider that changes colors gradually
Here, you are going to learn another type of customization that the player can perform at runtime. With this, the player has more power on how he can customize his own UI to fit suit his needs. In fact, the player will be able to switch between two colors, as in the previous chapter, but gradually and through a slider. We will handle this with a script and, as usual, using the events that are inside the Slider (Script) component.
How to do it...
- First of all, we need to create our slider. This can be done easily by right-clicking on the Hierarchy panel, then going to UI | Slider, and renaming it to GraduallyColorSlider. Of course, it is possible to resize the slider, change Source Image, or change ...
Get Unity UI Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.