UWA发布|Unity手游性能蓝皮书
- 作者:admin
- /
- 时间:2020年09月03日
- /
- 浏览:8151 次
- /
- 分类:充电一刻
作为游戏行业的服务商,UWA不仅为游戏开发者提供高效的性能优化工具,也致力于为行业提供更全面、更具体的信息和服务。为此,UWA今天发布2019-2020年度手游蓝皮书,分为三大模块:MMORPG篇、卡牌篇和ACT篇,从总体性能数据、引擎各模块开销、内存占用等方面进行汇总分析,呈现Unity手游行业现状。
这是侑虎科技原创文章,欢迎转发分享,未经官方授权请勿转载。如果您有任何独到的见解或者发现也欢迎联系我们,一起探讨。(QQ群:793972859)
MMORPG篇
MMORPG作为目前游戏市场上的头部力量,在UWA测评过的项目中,也占据了主要份额,因此我们以该类型的测评数据为例,为大家呈现2019-2020年的手游性能现状和发展趋势。
报告目录:
1)MMORPG手游总体性能开销分析
2)MMORPG手游CPU模块性能开销分析
3)MMORPG手游内存模块性能开销分析
4)MMORPG手游资源管理分析
5)UWA对于MMORPG手游研发团队的建议
MMORPG手游总体性能开销分析

Android设备的CPU均值主体范围为14.7~78.9 ms,且主要集中在17~33ms和33~50ms两档。
按照UWA官网(www.uwa4d.com)的测评机型分类,我们将统计的性能数据分为低端、中端和高端;在趋势图中则直接以最具有代表性的低端和高端来展现。


大部分MMORPG手游在中低端设备的性能开销较高,大于33ms的耗时占比范围在60%~70%。

无论是高、中和低端的Android设备,渲染和逻辑代码都是需要研发团队重点关注的,它们的消耗总和占了总开销的近70%。逻辑代码的耗时占比依然很高,这主要与角色、怪物的数量越来越多相关。随着其不断增加,逻辑状态的更新开销、AI开销等都在大幅增加,这是需要游戏研发团队中密切关注的耗时瓶颈。
下面我们就来具体分析这些主流模块的开销情况。
MMORPG手游CPU模块性能开销分析
一、渲染模块
严重程度:地狱
为了能够更好地反映出各个性能参数的整体使用情况,我们统计了每种性能参数的主体使用范围,其范围区间是[5%~95%],以下数据中P5代表5%,P50代表均值,P95代表95%。




在过去的4个季度中,半透明渲染和不透明渲染在低端设备上的CPU耗时在不断下降,Q2略有回升,这意味着游戏团队对于引擎渲染模块的理解越来越深入。


二、逻辑代码
严重程度:地狱


1)GC触发频率很高,是造成卡顿的主要原因之一,目前只有36.8%的项目可以将GC的触发频率控制在1000帧/次以上。
2)随着MMORPG游戏越来越重度化,GC平均耗时在逐步上升。GC耗时会逐渐成为游戏运行时的主流性能杀手,需要研发团队时刻注意!



我们可以看到,在过去的Q2中,Instantiate调用频率有明显下降,这说明大家在项目中不断重视对于资源Instantiate/Destroy的管理。
如果大家的项目中仍有大量的Instantiate/Destroy调用,那么我们建议您着重查看UWA线上性能报告中资源管理分类的“资源实例化/激活”页面,通过它可以快速掌握到底具体哪些GameObject在不停地被执行实例化操作,从而更为高效地减少不必要的性能开销。


Shader.Parse 操作是比较突出的性能杀手,但我们看到在2019的Q4中已经大幅度下降,目前平均每次调用的CPU耗时主要分布在 0.8~74.9 ms。
三、UI模块
严重程度:地狱
目前我们主要统计了NGUI、UGUI和FGUI的占比以及详细的使用情况。在刚刚过去的四个季度中,UGUI的使用占比依然强势,最高时可达72%。NGUI的占比有明显下降的趋势,而FGUI有明显上涨的趋势。

下面我们将分别说明它们的CPU耗时和堆内存占用情况。





UI模块的性能开销依然很高,但相较于去年相比确实有进一步提升。这主要是在这一年多以来,各大研发团队对于UGUI的理解和掌握都在不断深入。当然,现在UGUI的明显性能问题主要有以下四方面:
1.Draw Call;
2.重建;
3.OverDraw;
4.主线程阻塞。针对以上问题,大家可以通过UWA学堂(https://edu.uwa4d.com)中UI相关的相关技术问题和视频进行学习和了解,相信对帮助大家快速提升UI方面的技术理解大有裨益。
FGUI的性能看起来很不错,但是目前FGUI的使用量较少,可能存在一些统计偏差。仅供参考。
四、动画模块
严重程度:普通



动画模块在最近一年来的性能表现一直较为平稳,这说明大家对于动画模块中应有的性能优化点掌握已经较为到位。虽然MMO项目中的角色、NPC和怪物等数量持续有在增加,但在这些模型多数是通过GPU Skinning的方式来完成。这种方式对于实现场景中的大量同种怪物非常有效。
五、物理模块
严重程度:普通


物理模块的性能存在上升趋势,特别是高端设备上。对于使用Unity 2017.4版本以后的团队,Auto Simulation和Auto Sync Transforms是大家需要关心的参数,以避免不必要的性能耗时。
六、粒子模块
严重程度:普通




粒子系统的CPU开销普遍较低,但总体使用数量峰值在2020 Q1后大幅上升。我们依然建议研发团队尽可能将数量峰值控制在600以下(低端设备)和1000以下(中高端设备)。对此,建议研发团队经常通过以下两方面来检测自己的粒子特效使用情况:
1)粒子系统(特别是技能特效)的配置文件是否过量;
2)特效中是否含有长久不用的粒子系统。
MMORPG手游内存模块开销分析
一、内存泄露
严重程度:噩梦

内存泄露问题在过去的一年中明显加重,40%的提测项目都存在泄漏的问题。
我们建议研发团队后续可更为频繁地进行检测和监控,即可进一步降低堆内存泄露的风险。研发团队可通过以下两种方式高效地对堆内存泄露函数进行分析和优化:
1)UWA GOT Online中的详细Mono堆内存分析和Lua性能分析报告;
2)UWA线上深度测评中的详细Mono堆内存测评报告。
二、总体内存
严重程度:地狱


总体内存在最近的一年里,峰值均值稳步提升,共计提升了132MB。随着高端移动设备的普及、MMO游戏的逐步重度化,内存逐步提升是一个必然的趋势。目前,项目中的主要内存瓶颈依然是资源和Mono堆内存。对此,我们将在接下来的文章中进行详细分析。
三、总体堆内存
严重程度:地狱


总体堆内存在最近一年里上升趋势非常明显,这主要是游戏的重度化所致。但另一方面,也是研发团队对于Mono堆内存分配的疏于管理所致。就目前而言,Mono堆内存过高主要是因为配置文件的序列化库使用不当所致。
项目的内存占用很大一部分来自于资源的使用,下面我们将对项目中主流资源的使用情况进行分析。
四、纹理资源内存
严重程度:地狱


如上图所示,对于纹理资源来说,在过去的4个季度中,其内存占用处于上升阶段。建议研发团队对于纹理Mipmap使用情况、渲染利用率等进行进一步的检测和完善。
五、网格资源内存
严重程度:地狱


1)网格资源内存峰值主要分布为12.7~ 96.1 MB,且主要集中在60MB以内。
2)MMORPG游戏的场景普遍较大、角色普遍较多,因此,其网格资源量明显高于其它类型游戏。但从使用趋势上来看,其最近一年的使用趋势较为平稳,均值均在50MB-80MB浮动。
六、动画资源内存
严重程度:普通


动画模块的内存使用趋势较为平稳,平均峰值内存长期控制在20~40MB区间之内。
七、Shader资源内存
严重程度:普通


这里,UWA仍然需要提醒的是,Standard Shader在大家的项目中被经常误引入进来,建议大家在UWA性能简报中的“具体资源使用信息”中特别关注Standard Shader的使用情况。
八、RenderTexture资源内存
严重程度:噩梦


RenderTexture的内存占用在进入2020年Q1以后上升趋势明显,特别是在低端设备上,随着大家对于图像后处理效果的需求提升,后续很可能会出现RenderTexture使用程度大幅提升的情况,因此,建议研发团队对RenderTexture密切关注。
九、粒子系统资源内存
严重程度:噩梦


粒子系统的使用数量过大,从而导致其内存占用过高。对此,其最有效的优化方法还是降低粒子系统的使用数量,同时研发团队可以考虑在高端设备上使用GPU Particle 新功能,将大幅度提升粒子模块的性能。
MMORPG手游资源管理分析


AssetBundle加载方式(Load和LoadAsync)的使用占比在过去的一年中都保持在80%左右。毫无疑问,AssetBundle加载方式是目前绝大多数研发团队的资源加载首选。
在接下来的一年中,我们仍然建议大家使用AUP(Async Upload Pipleine)功能来尝试达到更高的加载效率。关于AUP中需要特别关注的技术点,建议查看UWA DAY 2019中的相关分享《Unity引擎加载模块和内存管理的量化分析及优化方法》,同时,我们在今年UWA DAY 2020上有了更详细的补充,建议大家后续关注。


在众多加载方式中,LoadFromFile加载方式依然是一家独大,LoadFromFile+LZ4的组合在移动游戏中加载性能优势明显,依然是移动游戏资源加载的不二选择。

1)对于Instantiate/Destroy的完善,研发团队需时刻关注缓存池的使用是否合理;
2)对于Active/Deactive的完善,则需要研发团队尽可能注意避免UI和动画角色的频繁调用,从而尽可能避免不必要的调用开销。
除了以上信息,今年UWA DAY 2020上我们还分享了其他重要的性能参数数据,不仅适用于MMO项目:譬如ASTC纹理的使用情况、SRP项目的使用情况、颜色空间的使用情况等,这些都是大家在立项或研发阶段较为关心的话题,我们将在后续的UWA DAY 2020视频中播出,欢迎大家关注。
SRP和颜色空间的使用情况图

ASTC纹理的使用占比趋势图

热更新库和序列化库的使用趋势图

同时,我们将本地资源检测服务中的检测结果进行了分析统计。对于检测未通过率高达70%以上的Top10的检测规则,建议大家多关注。研发团队也可以自行使用该服务,以检测自身项目是否存在类似的问题。

UWA对于MMORPG手游研发团队的建议
1、 警惕渲染模块、逻辑代码这两大性能杀手!随着精品化MMORPG项目的日益增多,这两项在接下来依然是研发团队在性能优化时的重中之重!
2、 内存泄露问题在过去的一年有恶化趋势,数据显示40%的项目存在着泄露问题,Mono堆内存、纹理、网格、RenderTexture和粒子系统依然是大家接下来需要关注的重点。特别是Mono堆内存部分,对于序列化信息的管理已经刻不容缓,在接下来的一年,UWA会尽可能为各大研发团队解决和监控这一内存难题。建议通过Mono和Asset模式持续监控。
3、 资源加载方面,在过去的一年中,LoadFromFile(Async)已经是移动游戏项目中的主流加载方式,AssetBundle.Load(Async)同样也是资源加载的主流方式,并且取得了明显的效果,UWA也建议国内各大研发团队开始着手进行学习和研究。
4、GPU性能问题在过去的一年中逐步凸显,在不少超重度MMO游戏中,GPU已经俨然成了游戏项目的主要瓶颈,对此,建议研发团队通过GOT Online的Overview模式检测GPU耗时,从而定位GPU的瓶颈。
卡牌篇
卡牌游戏作为目前游戏市场上的中坚力量,在UWA测评过的项目中,也占据了主要份额,因此我们以该类型的测评数据为例,为大家呈现2019-2020年的手游性能现状和发展趋势。
报告目录:
1)卡牌手游总体性能开销分析
2)卡牌手游CPU模块性能开销分析
3)卡牌手游内存模块性能开销分析
4)卡牌手游资源管理分析
卡牌手游总体性能开销分析

Android设备的CPU均值主体范围为7.9~56.2 ms,且主要集中在17~33ms和< 17ms两档。
按照UWA官网(www.uwa4d.com)的测评机型分类,我们将统计的性能数据分为低端、中端和高端;在趋势图中则直接以最具有代表性的低端和高端来展现。


大部分卡牌手游在中低端设备的性能开销较好,大于33ms的耗时占比范围仅占30%。

无论是高端还是低端的Android设备,渲染和逻辑代码都是需要研发团队重点关注的,它们的消耗总和占了总开销的近80%。
下面我们就来具体分析这些主流模块的开销情况。
卡牌手游CPU模块性能开销分析
一、渲染模块
严重程度:普通
为了能够更好地反映出各个性能参数的整体使用情况,我们统计了每种性能参数的主体使用范围,其范围区间是[5%~95%],以下数据中P5代表5%,P50代表均值,P95代表95%。




在过去的4个季度中,半透明渲染和不透明渲染在高端和低端设备上的性能均较为稳定。


二、逻辑代码
严重程度:地狱


1)GC触发频率很高,是造成卡顿的主要原因之一,目前只有51.2%的项目可以将GC的触发频率控制在1000帧/次以上。
2)游戏玩法越来越重度化,GC平均耗时在逐步上升。GC耗时会逐渐成为游戏运行时的主流性能杀手,需要研发团队时刻注意。


我们可以看到,在过去的Q2中,Instantiate调用频率有明显下降,这说明大家在项目中不断重视对于资源Instantiate/Destroy的管理。
如果大家的项目中仍有大量的Instantiate/Destroy调用,那么我们建议您着重查看UWA线上性能报告中资源管理分类的“资源实例化/激活”页面,通过它可以快速掌握到底具体哪些GameObject在不停地被执行实例化操作,从而更为高效地减少不必要的性能开销。


Shader.Parse 操作是比较突出的性能杀手,但我们看到在2019的Q4中已经大幅度下降,目前平均每次调用的CPU耗时主要分布在 0.7~76.8 ms。
三、UI模块
严重程度:地狱
目前我们主要统计了NGUI和UGUI的占比以及详细的使用情况。在刚刚过去的四个季度中,UGUI的使用占比依然强势,最高时可达97%。NGUI的占比有明显下降的趋势。

下面我们将分别说明它们的CPU耗时和堆内存占用情况。





UI模块的性能开销依然很高,但相较于去年相比确实有进一步提升。这主要是在这一年多以来,各大研发团队对于UGUI的理解和掌握都在不断深入。当然,现在UGUI的明显性能问题主要有以下四方面:
- Draw Call;
- 重建;
- OverDraw;
- 主线程阻塞。
针对以上问题,大家可以通过UWA学堂(https://edu.uwa4d.com)中UI相关的相关技术问题和视频进行学习和了解,相信对帮助大家快速提升UI方面的技术理解大有裨益。
四、动画模块
严重程度:普通



动画模块在最近一年来的性能表现一直较为平稳,这说明大家对于动画模块中应有的性能优化点掌握已经较为到位。
五、物理模块
严重程度:普通


物理模块的性能存在上升趋势,特别是高端设备上。对于使用Unity 2017.4版本以后的团队,Auto Simulation和Auto Sync Transforms是大家需要关心的参数,以避免不必要的性能耗时。
六、粒子模块
严重程度:普通




粒子系统的CPU开销普遍较低,但总体使用数量峰值在2020 Q1后大幅上升。我们依然建议研发团队尽可能将数量峰值控制在600以下(低端设备)和1000以下(中高端设备)。对此,建议研发团队经常通过以下两方面来检测自己的粒子特效使用情况:
1)粒子系统(特别是技能特效)的配置文件是否过量;
2)特效中是否含有长久不用的粒子系统。
卡牌手游内存模块开销分析
内存泄露
严重程度:噩梦

我们建议研发团队后续可更为频繁地进行检测和监控,即可进一步降低堆内存泄露的风险。研发团队可通过以下两种方式高效地对堆内存泄露函数进行分析和优化:
1)UWA GOT Online中的详细Mono堆内存分析和Lua性能分析报告;
2)UWA线上深度测评中的详细Mono堆内存测评报告。
总体内存
严重程度:噩梦


总体内存在最近的一年里,峰值均值较为稳定。对此,我们将在接下来的文章中进行详细分析。
总体堆内存
严重程度:噩梦


总体堆内存在最近一年里在70-80MB震荡。
项目的内存占用很大一部分来自于资源的使用,下面我们将对项目中主流资源的使用情况进行分析。
纹理资源内存
严重程度:噩梦


如上图所示,对于纹理资源来说,在过去的2个季度中,其内存占用处于下降阶段。建议研发团队对于纹理Mipmap使用情况、渲染利用率等进行进一步的检测和完善。
网格资源内存
严重程度:普通


网格资源内存峰值主要分布为1.5~ 64.8 MB。其最近一年的使用趋势较为平稳,均值均在20MB-30MB浮动。
动画资源内存
严重程度:普通


动画模块的内存使用趋势较为平稳,平均峰值内存长期控制在20~30MB区间之内。
Shader资源内存
严重程度:普通


这里,UWA仍然需要提醒的是,Standard Shader在大家的项目中被经常误引入进来,建议大家在UWA性能简报中的“具体资源使用信息”中特别关注Standard Shader的使用情况。
RenderTexture资源内存
严重程度:噩梦


RenderTexture的内存占用在进入2020年Q1以后上升趋势明显,特别是在低端设备上,随着大家对于图像后处理效果的需求提升,后续很可能会出现RenderTexture使用程度大幅提升的情况,因此,建议研发团队对RenderTexture密切关注。
粒子系统资源内存
严重程度:噩梦


粒子系统的使用数量过大,从而导致其内存占用过高。对此,其最有效的优化方法还是降低粒子系统的使用数量,同时研发团队可以考虑在高端设备上使用GPU Particle 新功能,将大幅度提升粒子模块的性能。
卡牌手游资源管理分析


AssetBundle加载方式(Load和LoadAsync)的使用占比在过去的一年中都保持在80%左右。毫无疑问,AssetBundle加载方式是目前绝大多数研发团队的资源加载首选。
在接下来的一年中,我们仍然建议大家使用AUP(Async Upload Pipleine)功能来尝试达到更高的加载效率。关于AUP中需要特别关注的技术点,建议查看UWA DAY 2019中的相关分享《Unity引擎加载模块和内存管理的量化分析及优化方法》,同时,我们在今年UWA DAY 2020上有了更详细的补充,建议大家后续关注。


在众多加载方式中,LoadFromFile加载方式依然是一家独大,LoadFromFile+LZ4的组合在移动游戏中加载性能优势明显,依然是移动游戏资源加载的不二选择。

1)对于Instantiate/Destroy的完善,研发团队需时刻关注缓存池的使用是否合理;
2)对于Active/Deactive的完善,则需要研发团队尽可能注意避免UI和动画角色的频繁调用,从而尽可能避免不必要的调用开销。
除了以上信息,今年UWA DAY 2020上我们还分享了其他重要的性能参数数据,不仅适用于卡牌项目:譬如ASTC纹理的使用情况、SRP项目的使用情况、颜色空间的使用情况等,这些都是大家在立项或研发阶段较为关心的话题,我们将在后续的UWA DAY 2020视频中播出,欢迎大家关注。
ACT篇
ACT作为目前游戏市场上的中间力量,在UWA测评过的项目中,也占据了主要份额,因此我们以该类型的测评数据为例,为大家呈现2019-2020年的手游性能现状和发展趋势。
报告目录:
1)ACT手游总体性能开销分析
2)ACT手游CPU模块性能开销分析
3)ACT手游内存模块性能开销分析
4)ACT手游资源管理分析
ACT手游总体性能开销分析



Android设备的CPU均值主体范围为9.1~70.5 ms,且主要集中在17~33ms和33~50ms两档。
按照UWA官网(www.uwa4d.com)的测评机型分类,我们将统计的性能数据分为低端、中端和高端;在趋势图中则直接以最具有代表性的低端和高端来展现。

无论是高、中还是低端的Android设备,渲染和逻辑代码都是需要研发团队重点关注的,它们的消耗总和占了总开销的80%左右。与MMO和卡牌RPG不同的是,ACT手游的逻辑代码耗时占比是最高的,这主要与角色、怪物的数量越来越多相关。随着其不断增加,逻辑状态的更新开销、AI开销等都在大幅增加,这是需要游戏研发团队中密切关注的耗时瓶颈。
下面我们就来具体分析这些主流模块的开销情况。
ACT手游CPU模块性能开销分析
一、渲染模块
严重程度:噩梦
为了能够更好地反映出各个性能参数的整体使用情况,我们统计了每种性能参数的主体使用范围,其范围区间是[5%~95%],以下数据中P5代表5%,P50代表均值,P95代表95%。




在过去的4个季度中,半透明渲染和不透明渲染耗时均在一定程度上有所震荡,且从整体趋势来看耗时均在逐步上升,建议关注。


二、逻辑代码
严重程度:地狱


1)GC触发频率很高,是造成卡顿的主要原因之一,目前只有37.6%的项目可以将GC的触发频率控制在1000帧/次以上。
2)随着ACT游戏越来越重度化,GC平均耗时在逐步上升。GC耗时会逐渐成为游戏运行时的主流性能杀手,需要研发团队时刻注意!


如果大家的项目中仍有大量的Instantiate/Destroy调用,那么我们建议您着重查看UWA线上性能报告中资源管理分类的“资源实例化/激活”页面,通过它可以快速掌握到底具体哪些GameObject在不停地被执行实例化操作,从而更为高效地减少不必要的性能开销。


Shader.Parse 操作是比较突出的性能杀手,目前平均每次调用的CPU耗时主要分布在 0.6~60.6ms。在2019 Q4以后,Shader.Parse的CPU开销下降明显,说明大家对于该函数的理解越来越深入。
关于逻辑代码方面的优化,强烈推荐大家参阅UWA DAY 2020演讲议题《手中的银河》,该项目在解决全球同服、千人团战等特色需求的过程中,总结出不少逻辑层面的优化心得。
三、UI模块
严重程度:地狱
目前我们主要统计了NGUI和UGUI占比的使用情况。在刚刚过去的四个季度中,UGUI的使用占比依然强势,最高时可达63%。NGUI的占比有明显下降的趋势,在2020 Q2时又上升至44%。

下面我们将分别说明它们的CPU耗时和堆内存占用情况。





UI模块的性能开销依然很高,但相较于去年相比确实有进一步提升。这主要是在这一年多以来,各大研发团队对于UGUI的理解和掌握都在不断深入。当然,现在UGUI的明显性能问题主要有以下四方面:
- Draw Call;
- 重建;
- OverDraw;
- 主线程阻塞。
针对以上问题,大家可以通过UWA学堂(https://edu.uwa4d.com)中UI相关的相关技术问题和视频进行学习和了解,相信对帮助大家快速提升UI方面的技术理解大有裨益。
四、动画模块
严重程度:噩梦



动画模块在最近一年来的性能耗时逐步上升,这说明大家对于动画模块越来越重度。目前ACT项目中的角色、NPC和怪物等数量持续有在增加,我们建议对于大量同种模式尽可能通过GPU Skinning的方式来完成。
五、物理模块
严重程度:普通


物理模块的性能存在上升趋势,特别是高端设备上。对于使用Unity 2017.4版本以后的团队,Auto Simulation和Auto Sync Transforms是大家需要关心的参数,以避免不必要的性能耗时。
六、粒子模块
严重程度:普通




粒子系统的CPU开销普遍较低,但总体使用数量峰值均值在2020 Q1后大幅上升,我们依然建议研发团队尽可能将数量峰值控制在600以下(低端设备)和1000以下(中高端设备)。对此,建议研发团队经常通过以下两方面来检测自己的粒子特效使用情况:
1)粒子系统(特别是技能特效)的配置文件是否过量;
2)特效中是否含有长久不用的粒子系统。在前不久的UWA DAY 2020大会上,广州库洛的技术负责人林晨晨就《战双帕弥什》的粒子系统优化做了深度的分析,推荐大家学习观看https://edu.uwa4d.com/course-intro/1/207
ACT手游内存模块开销分析
内存泄露
严重程度:噩梦

关于内存泄露的问题,我们建议研发团队后续可更为频繁地进行检测和监控,即可进一步降低堆内存泄露的风险。研发团队可通过以下两种方式高效地对堆内存泄露函数进行分析和优化:
1)UWA GOT Online中的详细Mono堆内存分析和Lua性能分析报告;
2)UWA线上深度测评中的详细Mono堆内存测评报告。
总体内存
严重程度:地狱


总体内存在最近的一年里,峰值均值稳步提升,共计提升了近100MB。随着高端移动设备的普及、ACT游戏的逐步重度化,内存逐步提升是一个必然的趋势。目前,项目中的主要内存瓶颈依然是资源和Mono堆内存。对此,我们将在接下来的文章中进行详细分析。
总体堆内存
严重程度:地狱


总体堆内存在最近一年里上升趋势非常明显,这主要是游戏的重度化所致。但另一方面,也是研发团队对于Mono堆内存分配的疏于管理所致。就目前而言,Mono堆内存过高主要是因为配置文件的序列化库使用不当所致。
项目的内存占用很大一部分来自于资源的使用,下面我们将对项目中主流资源的使用情况进行分析。
纹理资源内存
严重程度:噩梦


如上图所示,对于纹理资源来说,在过去的4个季度中,其内存占用处于逐步上升趋势。建议研发团队对于纹理Mipmap使用情况、渲染利用率等进行进一步的检测和完善。
网格资源内存
严重程度:噩梦


网格资源内存峰值主要分布为 0.8~ 131.6 MB。从使用趋势上来看,其最近一年的使用趋势较为平稳,均值均在20MB-40MB浮动。
动画资源内存
严重程度:普通


动画模块的内存使用趋势较为平稳,平均峰值内存长期控制在30MB之内。
Shader资源内存
严重程度:普通


这里,UWA仍然需要提醒的是,Standard Shader在大家的项目中被经常误引入进来,建议大家在UWA性能简报中的“具体资源使用信息”中特别关注Standard Shader的使用情况。
RenderTexture资源内存
严重程度:噩梦


RenderTexture的内存占用在进入2019年Q3以后上升趋势明显,特别是在低端设备上,随着大家对于图像后处理效果的需求提升,后续很可能会出现RenderTexture使用程度大幅提升的情况,因此,建议研发团队对RenderTexture密切关注。
粒子系统资源内存
严重程度:噩梦


粒子系统的使用数量过大,从而导致其内存占用过高。对此,其最有效的优化方法还是降低粒子系统的使用数量,同时研发团队可以考虑在高端设备上使用GPU Particle 新功能,将大幅度提升粒子模块的性能。
同时,UWA已经推出了本地资源检测服务,针对项目工程中的静态资源(比如纹理、网格、音频、动画以及粒子系统、代码设置等等)可做检测,来检测美术资源是否有哪些资源设置不合理,做到静态资源的及时问题反馈、及时修复。
ACT手游资源管理分析


AssetBundle加载方式(Load和LoadAsync)的使用占比在过去的一年中都保持在80%左右。毫无疑问,AssetBundle加载方式是目前绝大多数研发团队的资源加载首选。
在接下来的一年中,我们仍然建议大家使用AUP(Async Upload Pipleine)功能来尝试达到更高的加载效率。关于AUP中需要特别关注的技术点,建议查看UWA DAY 2019中的相关分享《Unity引擎加载模块和内存管理的量化分析及优化方法》,同时,我们在今年UWA DAY 2020上有了更详细的补充,建议大家后续关注。


在众多加载方式中,LoadFromFile加载方式依然是一家独大,LoadFromFile+LZ4的组合在移动游戏中加载性能优势明显,依然是移动游戏资源加载的不二选择。
对于Addressable感兴趣的团队,可以查看UWA DAY 2020的《基于Addressable资源管理系统的大地形加载方法探究》,我们对其进行了详细的分析。

1)对于Instantiate/Destroy的完善,研发团队需时刻关注缓存池的使用是否合理;
2)对于Active/Deactive的完善,则需要研发团队尽可能注意避免UI和动画角色的频繁调用,从而尽可能避免不必要的调用开销。
除了以上信息,今年UWA DAY 2020上我们还分享了其他重要的性能参数数据,不仅适用于ACT项目:譬如ASTC纹理的使用情况、SRP项目的使用情况、颜色空间的使用情况等,这些都是大家在立项或研发阶段较为关心的话题,现在均已在UWA学堂上播出。
如果大家优化CPU,《Unity移动游戏项目优化案例分析》是大家的优化宝典。
如果大家关注内存层面的优化,一起向《天谕》手游学习内存控制的绝技。
....
更多优秀精品课程,关注UWA学堂,了解最新UWA DAY 2020课程。
【在理】还有4门免费专享议题喔~
