- Unity - Using the Asset Store
- Unity - The Particle System
- Unity - Materials and Shaders
- Unity - The Slider
- Unity - Text Element
- Unity - The Button
- Unity - Starting with UI
- Unity - Introduction to Audio
- Unity - The Console
- Unity - Coroutines
- Unity - GameObject Destruction
- Understanding Prefabs and Instantiation
- Unity - Custom Collision Boundaries
- Unity - Rigidbodies and Physics
- Unity - Understanding Collisions
- Unity - Basic Movement Scripting
- Unity - Saving and Loading Scenes
- Unity - Internal Assets
- Transforms and Object Parenting
- Unity - Modifying Sprites
- Unity - Creating Sprites
- Unity - Installation and Setting Up
- Unity - Introduction
- Unity - Home
Unity Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Unity - The Spder
In this chapter, we will learn about the last UI element in this series. The Spder is commonly used where a certain value should be set between a maximum and minimum value pair. One of the most common usage of this is for audio volume, or screen brightness.
To create a spder, go to Create → UI → Spder. A new Spder element should show up on your scene.
If you go to the properties of this Spder, you will notice a ist of options to customize it.
Let us try to make a volume spder out of this spder. For this, open the ButtonBehaviour script (you can rename the ButtonManager GameObject as it is certainly doing more than just managing a button now) and add a reference to the Spder. We will also change the code around a bit again.
pubpc class ButtonBehaviour : MonoBehaviour { int n; pubpc Text myText; pubpc Spder mySpder; void Update() { myText.text = "Current Volume: " + mySpder.value; } }
Understand how we are using the Update method to constantly update the value of myText.text.
In the spder properties, let us check the “Whole Numbers” box, and set the maximum value to 100.
We will set the color of the text through its properties for a more visible color.
Let us follow the same procedure of dragging the Spder GameObject onto the new slot, and hit play.
It is highly recommended you explore and experiment with the other UI controls as well, to see which ones work in which way.
In our subsequent section, we will learn about pghting, materials and shaders.
Advertisements