Hi: I am new to unity; and to Javascript…for my first project I am modifying the Island demo. I am planning to stream it via the Unity web player to people who visit my website. I have created a level0 that is 400K; the level 1 is 2 MB.
Problem:
When level0 is playing, I would like to display a progress bar that reflects the load status of level1…with text that says, “Your Boat is On the Way”. Can anyone help me with a script to do this
(I have tried to figure it out using EditorUtility.DisplayProgressBar but I can’t get it to work). Help would be appreciated.
Here is my GUI script that I am currently using in Level0:
var customLabel : GUIStyle;
var customSmLabel : GUIStyle;
var customColorSmLabel : GUIStyle;
private var level1 : float;
function OnGUI () {
//print unchanging GUI text
GUI.Label (Rect (Screen.width - 150,Screen.height * 0.9,300,60), “www.TeachHealth.com”);
GUI.Label (Rect (10,10,300,60), “Welcome To”, customSmLabel);
GUI.Label (Rect (10,40,300,60), “Heron Island”, customLabel);
//print GUI text that changes with Time.time
if(Time.time>2 Time.time<14)
GUI.Label (Rect (10,80,300,60), “Please wait for the boat”,customSmLabel);
if(Time.time>4 Time.time<14)
GUI.Label (Rect (10,100,300,60), “It will arrive shortly”,customSmLabel);
if(Time.time>6 Time.time<14)
GUI.Label (Rect (10,130,300,60), “When you enter the Island”,customSmLabel);
if(Time.time>8 Time.time<14)
GUI.Label (Rect (10,160,300,60), “Enjoy the Serenity”,customSmLabel);
if(Time.time>10 Time.time<14)
GUI.Label (Rect (10,180,300,60), “Stroll along the beach”,customSmLabel);
if(Time.time>12 Time.time<14)
GUI.Label (Rect (10,200,300,60), “Relax at the river”,customSmLabel);
//wipe screen, print next set of GUI text
if(Time.time>14 Time.time<20)
GUI.Label (Rect (10,80,300,60), “Play with the Herons”,customSmLabel);
if(Time.time>16 Time.time<20)
GUI.Label (Rect (10,100,300,60), “Hike in the Mountains”,customSmLabel);
if(Time.time>18 Time.time<20)
GUI.Label (Rect (10,120,300,60), “Leave the City Behind”,customSmLabel);
//wipe screen, print next set of GUI text
if(Time.time>20)
GUI.Label (Rect (10,90,350,60), “to VIEW FULL SCREEN”,customColorSmLabel);
if(Time.time>20)
GUI.Label (Rect (50,120,350,60), “right or Ctrl-click”,customColorSmLabel);
//check progress of Level1 streaming
level1 = Application.GetStreamProgressForLevel(“Islands3”);
//when load of level1 is complete, display enter button
if (level1 == 1 Time.time>24){
GUI.Label (Rect (10,160,350,60), "Your Boat has arrived. ",customSmLabel);
if (GUI.Button (Rect (80,200,100,20), “Start Vacation”)) {
Application.LoadLevel (“Islands3”);
}
}
}