- Home /
Loading bar for NEXT scene/level...
Code question...
Ok, here's the lowdown:
1) We have a Menu scene, the Game scene, then Score scene (simplified breakdown) for web player distro...for now.
2) We set the First Streaming Level 0 (as default, the Menu), loaded Menu scene fairly quickly, click "Start" to go to the actual Game scene...and sits there...sits there...sits there...sits there...in the meantime, people are clicking the heck out of the "Start" button wondering why it's not loading, soooooo....
3) We set First Streaming Level to 1 (our Game scene), thinking it won't display Menu scene until Game scene is loaded...but this achieved NO DIFFERENCE in delay after clicking "Start" in Menu scene...sigh.
With this in mind, we decided we definitely need at least a loader bar (as visual feedback to the player) to let them know SOMETHING is happening during the delay while loading the Game scene...and yes, I've read about the "GetStreamProgressForLevel" and "CanStreamedLevelBeLoaded" but we're designers and not really coder-types, so can someone show WORKING code (not THEORETICAL) for doing this?
We would like to re-use our custom loader bar that we are currently using for the web player loader, just have it show after player clicks "Start" or any other scene from the Menu choices...
LINK: http://clients2.g2mediagroup.com/cmc..._20111215.html
Thanks for any help!
Have you also read the documentation on `GetStreamProgressForLevel`? It looks pretty practical to me.
Answer by dorpeleg · Jan 05, 2012 at 07:12 PM
here's the code from the docs
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public float percentageLoaded = 0;
void Update() {
if (Application.GetStreamProgressForLevel(1) == 1)
guiText.text = "Level at index 1 has been fully streamed!";
else {
percentageLoaded = Application.GetStreamProgressForLevel(1) * 100;
guiText.text = percentageLoaded.ToString();
}
}
}
looks like thats what your looking for
Your answer
Follow this Question
Related Questions
Multiple scenes 2 Answers
Switching scenes 1 Answer
Enter building script for a open world game 0 Answers
scene loading 100's of scenes 3 Answers
Help with error message "Overwriting the same path as another open scene is not allowed" 0 Answers