Created
November 15, 2013 08:01
-
-
Save cnsoft/7480766 to your computer and use it in GitHub Desktop.
Photon Network Library Preloader.cs show how to implement loading progress ui.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class Preloader : Photon.MonoBehaviour | |
{ | |
public GUISkin skin; | |
void Update() | |
{ | |
//Wait for both mainmenu&game scene to be loaded (since mainmenu doesnt check on game scene) | |
if (Application.GetStreamProgressForLevel(1) >= 1 && Application.GetStreamProgressForLevel(2) >= 1) | |
Application.LoadLevel(1); | |
} | |
void OnGUI() | |
{ | |
GUI.skin = skin; | |
GUI.Label(new Rect(Screen.width / 2 - 70, Screen.height / 2 - 12, 140, 25), "Loading: " + (int)(Application.GetStreamProgressForLevel(2) * 100)+"%"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment