Skip to content

Instantly share code, notes, and snippets.

@cnsoft
Created November 15, 2013 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cnsoft/7480766 to your computer and use it in GitHub Desktop.
Save cnsoft/7480766 to your computer and use it in GitHub Desktop.
Photon Network Library Preloader.cs show how to implement loading progress ui.
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