|
How do I make a progress bar using GUITextures that gets shorter when a variable decreases using JavaScript?
(comments are locked)
|
|
Here's some code for a simple working progress bar display. In this example, the 'progress' value is taken directly from the time, but you should set it to a value between zero and one from whatever source you want to display the progress of.
The use of 'Clamp01' limits the bar's width to prevent it from growing longer than the specified size. It's worth noting that the 'full' texture stretches as it expands, rather than revealing its image which would be more desirable. I have played with the "ScaleMode" parameter to try and overcome this, and the closest I can get is to use the following modification to the second DrawTexture call:
However unfortunately the cropping effect is centred rather than flush left, so it still looks a bit odd! This solution makes use of OnGUI, which is slow on the iPhone. The original question pertains to the usage of GUITextures which is an old alternative to OnGUI.
Oct 27 '10 at 07:08 AM
anomalous_underdog
snippet that uses gui groups is @ http://answers.unity3d.com/questions/4456/how-would-you-make-an-energy-bar-loading-progress-bar-health-meter-or-other-vi
May 09 '11 at 08:53 PM
ina
thanks to Molix's answer, I came to a good way to crop:
Dec 20 '11 at 06:50 PM
Cawas
I tried this script but I can't see "progressBarFull" ! Its width should increase as "progress" increases, right ? but it doesn't happen! where is the catch ?!
Aug 13 '12 at 01:08 PM
NewAlpha
im having the same issue, the scene hangs while loading the next one. the progress bar is drawn, partialy (about 1/3) loaded but it doesnt change in time
Feb 21 at 10:28 AM
vanss2
(comments are locked)
|
|
try this: This solution makes use of OnGUI, which is slow on the iPhone. The original question pertains to the usage of GUITextures which is an old alternative to OnGUI.
Oct 27 '10 at 07:10 AM
anomalous_underdog
(comments are locked)
|
|
What I did is to use a slider, and use skins to make it look like a progress bar.
(comments are locked)
|
|
I haven't actually implemented this in Unity, but typically what you do is to set the width of your draw Rect to a product of your variable. Example, if the variable is 0 to 1, and you want a progress bar 20 x 200 pixels: Rect(0, 0, 20, myVar * 200)
(comments are locked)
|
|
Hi ! I'm looking for this kind of script. I have two questions : 1) My project has several scene (6 scenes).How can I use this script to integrate all my scene ? I think that this script only contain the first scene. 2) How can I hide the laoding bar when the progress bar is done ? Thanks for your help. sorry, answering is the wrong place to ask questions.
Jan 16 '12 at 12:48 PM
Cawas
How can i make it decrease instead of increasing?
Apr 18 '12 at 02:39 PM
leo77748
(comments are locked)
|
1 2 next page »
