Unity Quick Tip - Assigning a Range to a Field
We’ll add a new script to the Main Camera by selecting it in the Hierarchy, clicking the 'Add Component' button in the Inspector, and then searching for the script component.
If we now switch back to the script we can use the Range attribute to set a minimum and maximum value for the field.
If we save this and switch back to Unity we can see that the free entry textbox for the field has now been replaced with a slider that lets us set a value within our specified range.
That covers everything for this tip. We hope that you found it useful. Please leave any questions or feedback in the comments below, and don't forget to subscribe to get notified when we publish our next post.