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 } } }
时间: 2024-10-15 18:18:53