生成控制大量物体考究
如果要控制大量的物体,这些物体所花的时间为多少
----------------------------------------------------------准备Preparb
根据 参考资料1 获得代码执行时间的函数为
sw.Start();和sw.Stop();之间进行生成物体的函数,就可以获得当前函数代码执行的时间
Stopwatch sw = new Stopwatch();
sw.Start();
//TestMethod();
InitGO(GO_num);
sw.Stop();
UnityEngine.Debug.Log(string.Format( "生成物体数量 Init GO num:" + GO_num + " 所花时间total time: {0} ms", sw.ElapsedMilliseconds));
一个是空物体GO,另外一个是单位立体方块TestCube
using UnityEngine;
using System.Collections;
using System.Diagnostics;
public class TestGO : MonoBeh