- Home /
Unity 5.0 Progress bar for scene loading JS
Hello
I need simple example unity script code for unity 5 progress bar for scene loading. I see this links and couldn't find the answer and also watch some old tutorials but couldn't understand any thing :(
http://answers.unity3d.com/questions/457594/how-to-make-a-progress-bar-for-loading-next-scene.html
thanks in advance
I guess you'll need Unity pro for this feature (Application.LoadLevelAdditiveAsync)
http://docs.unity3d.com/ScriptReference/Application.LoadLevelAdditiveAsync.html
and to get the progress value (see preview in link): async.progress
...
No need of Unity pro. Since Unity5 all game engine features are all included !
Answer by KdRWaylander · May 19, 2015 at 02:37 PM
Hi,
As @hoekkii said, you can have the progress of LoadLevelAsync with http://docs.unity3d.com/ScriptReference/AsyncOperation-progress.html
So now we have a float between 0 and 1.0f or 0 and 100.0f i guess and that's a good start !
Now there are like thousands of techniques for a loading bar ! Based on the progress float you can, fill an image, instantiate little cubes, plays different noises, turn up the volume ...
Let's focus on the classical one, the bar that fills up.
In a canvas add an image. Its type should be simple right now, change it to filled and adjust the parameters:
Fill method: Horizontal
Fill origin: Left
Fill amount: 0
Now with a script attached to the image, in the Update() function, make the fill amount equal to the progress float (make sure that this float is between 0 and 1)
Here you go :)
Cheers
Answer by Aily · Nov 11, 2016 at 12:23 PM
IEnumerator Start ()
{
var op = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(sceneName);
while (!op.isDone)
{
print(op.progress);
yield return null;
}
}
Your answer
Follow this Question
Related Questions
Load GameObject 3D model from server 1 Answer
Saving an Object of a Class 1 Answer
Best way to make an animated infinite striped progress bar? 1 Answer
No Resources.Load() avaliable 1 Answer
random level loader? 1 Answer