Unity中的Coroutine(协程) 估计熟悉Unity的人看过或者用过StartCoroutine() 假设我们在场景中有一个UGUI组件, Image: 将以下代码绑定到Image using UnityEngine; using System.Collections; using System.Threading; using UnityEngine.UI; public class CoroutineDemo : MonoBehaviour { // Use this for ini…
using UnityEngine; using System.Collections; using UnityEngine.SceneManagement; using System; public class LoadingPage : MonoBehaviour { public UISlider progressBar; // 目标进度 ; // 读取场景的进度,取值范围0~1 ; // 异步对象 AsyncOperation op = null; void Start () { Deb…
两种方法都可以传递参数,代码如下: using UnityEngine; using System.Collections; public class Test : MonoBehaviour { void Start() { StartCoroutine("Method", "AaronBlog"); StartCoroutine(Method("AaronBlog")); } IEnumerator Method(string name) {…