Advertisement

Unity精灵与对象生成及控制时间管理

阅读量:

生成控制大量物体考究

若需操控众多物体,其所需耗费的时间具体为多少

----------------------------------------------------------准备Preparb

依据参考资料1中所提供的方法,可获取代码执行时间的函数为

初始化Stopwatch对象sw,并通过调用Start()与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

![](https://ad.itadn.com/c/weblo

全部评论 (0)

还没有任何评论哟~