define value with range(minimum,maximum)
hi , How can i define a value with range of minimum and maximum for example i am going to make a healthbar and there is a float maxHP and float currentHP and i want to make a public int HpPercentage wich have minimum of 0 and maximum of 100 this is what i am looking for , i know i can do it in another ways but i wanna know if there is a way to define value with range at frist
Public Int HpPercentage(range(0,100));
Answer by MichaelKingsman · Aug 11, 2019 at 10:21 AM
And again i found answer right after posting it .
[Range(0,100)] Public int HpPercentage;
Your answer
![](https://koobas.hobune.stream/wayback/20220612210452im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I make my healthbar change color depending on damage? 1 Answer
Need enemy to attack player and deplete health 0 Answers
How do I create an undertale player health bar in C#? 1 Answer
Stuck on a project, need help with mechanics 0 Answers
Problem with int values + 1 gives unexpected values 1 Answer