- Home /
Load bar in GameObject
Hi All! I'm making a simple RTS game and I have an ISO Camera setup with a terrain and some buildings (3d game objects) and I'd like to add a Load bar when the building is instantiated onto the ground. Now I'm using an empty game object with a TextMesh to display the name of the building, but how can I display a loading/energy bar like the TextMesh?
Answer by korbul · Jul 27, 2017 at 11:15 AM
You can use a UI slider with the handle removed inside a canvas set to world space like this
You can access it through Slider.Value https://docs.unity3d.com/ScriptReference/UI.Slider-value.html
Answer by spidermancy612 · Jul 27, 2017 at 03:34 PM
I would use an In World Canvas Image that's been set to fill mode. From there you can access the fill by using FillAmount.
https://docs.unity3d.com/ScriptReference/UI.Image-fillAmount.html