kingBook

导航

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 } } }

 

posted on 2017-03-01 10:13  kingBook  阅读(862)  评论(0编辑  收藏  举报