So i am trying to make a game similar to AdVenture Capitalist. So i cant seem to figure how to make those progres bars in order to gain money. Does anyone have any suggestions?
You could use a slider and make some modifications to the material. The important part is changing the value. You could create a reference to the slider such as Slider mySlider = GetComponent<Slider>();
. Then, you can change the value based on your progress by setting the value
of the slider:
mySlider.value = someFloatValue;
If you would like to create a percentage progress bar, you can set the slider’s max value to 1. You can then divide the current float value by the maximum to get a percentage, and set the slider’s value from that. Something like this:
float somePercent = 6f; //50% of 12
Slider mySlider = GetComponent<Slider>();
void Start() {
mySlider.value = somePercent / 12f; //assuming that somePercent has a max value of 12
}
After this, you can set the interactable of the Slider to false, so it is really just a visual element. Then modify some textures, and boom! Good luck. Let me know if you need more explaining.