- Home /
Question by
SwordDancer · May 20, 2014 at 09:41 AM ·
webplayerloadlevelasync
Web Player only can run in opera
I am trying to get a web player to use LoadLevelAsync. When I run the project in chrome or IE there is an error, like this.
But When I run the project in opera it can run perfect.I don't know why, I hope someone can tell me. Here is my code.
using UnityEngine;
using System.Collections;
public class Loading : MonoBehaviour {
//构造一个Texture2d数组,用以存放Loading界面中动画所需要的图片。
public Texture2D[] texture2D;
private int index = 0;
private int fps = 12;
private float time = 0;
AsyncOperation async;
// Use this for initialization
void Start () {
StartCoroutine(loadScene());
}
IEnumerator loadScene()
{
//异步读取场景。
//Globe.loadName 就是A场景中需要读取的C场景名称。
async = Application.LoadLevelAsync(PublicClass.sceneName);
//读取完毕后返回, 系统会自动进入C场景
yield return async;
}
void OnGUI(){
// this.guiSkin = guiSkin;
//循环播放12个图片,以达到动画的效果。
time += Time.deltaTime;
if(time >= 1.0 / 12){
index++;
time = 0;
if(index >= 12){
index = 0;
}
}
GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), texture2D[1+index]);
}
// Update is clicked once per frame
void Update () {
}
}
qq截图20140520171658.jpg
(106.5 kB)
Comment