unity
Unity3D多线程写法
# Unity3D更多资源教程免费下载 的多线程写法如下: ```csharp using UnityEngine; using System.Collections; using System.Threading; public class MyThread { public int count; string thrdName; public MyThread(string nam) { count = 0; thrdName = nam; } public void run() { Debug.Log("startrun a thread" + Time.time); do { Thread.Sleep(1000); Debug.Log("inchild thread" + Time.time + "count=" + count); count++; } while (count < 20); Debug.Log("endthread" + Time.time); } } public class testThread : MonoBehaviour { void Start() { Debug.Log("startmain" + Time.time); MyThread mt = new MyThread("CHILE "); Thread newThrd = new Thread(new ThreadStart(mt.run)); newThrd.Start(); } void Update() { Debug.Log(Time.time); } }