首页 > 代码库 > unity WWW加载进度条

unity WWW加载进度条

using UnityEngine;
using System.Collections;

public class testProgress : MonoBehaviour {

   void Start () { StartCoroutine (getWWW()); } IEnumerator getWWW(){ WWW www = new WWW ("http://192.168.1.106/app/s01.mp3"); string progress; while(!www.isDone){ progress=(((int)(www.progress * 100)) % 100) + "%"; Debug.Log (progress); yield return 1; } if(www.error!=null){ Debug.Log ("loading error:"+www.url); }else{ progress="100%"; Debug.Log (progress); //enter complete code } } }

 

unity WWW加载进度条