当前位置:网站首页>Unity performance optimization direction
Unity performance optimization direction
2022-07-25 21:56:00 【Shadowrabbit】
List of articles
1 Cpu
1.1 Rendering
1.1.1 Reduce drawcall
adopt batch Reduce ; Note that the bus bandwidth should not be allowed after approval gpu overpressure
Reduce the number of rendered objects ;
1.1.2 resource optimization
Irregular grid 、 Texture and so on
1.1.3 LOD
High accuracy for close objects , Low precision model for long-distance objects
1.1.4 Occlusion culling
Objects that are completely occluded are not rendered
1.1.5 Long distance culling
Objects too far away are not rendered , It is also applicable to calculation , such as MC Block mechanism
1.2 UI
1.2.1 Combined batch
UI Pay attention to atlas allocation , There are also some special components like mask、outline And so on will interrupt the approval
1.2.2 The reconstruction
One node update will lead to the whole canvas The reconstruction , Although each of them canvas Occupied a draw call, But also be careful not to pile up too many irrelevant modules in the same canvas Lead to frequent reconstruction .
1.3 load
1.3.1 Inclusion dependency
If there is no correct inclusion dependency , It will cause the public resources to be packaged N Time
1.3.2 Preloading
If the resource is not loaded ,Instantiate Resources will be loaded before instantiation , Will slow down the speed , So we need to preload these resources when loading levels according to the configuration . Anyway loading Medium slow is slow .
1.3.3 Code efficiency
The algorithm takes time complexity into consideration ,update Be careful about the calculation in , Don't count the cached values every time .
1.3.4 Object pool optimization
Destory Objects also drag cpu, Consider object pool reuse , Slow release pool to slowly release . Destroying a large number of objects at the same time will jam
2 Gpu
2.1 Reduce rendering pixels
2.1.1 Map optimization Reduce the area
Remove transparent invalid areas
2.1.2 Add vertex Reduce the area
2.1.3 Customize shader Reduce the number of faces
Avoid overlapping multiple textures , Customize shader Sample from multiple textures
2.1.4 UI
The nine palaces are hollowed out , avoid mask, Eliminate transparent buttons
2.1.5 Reduce shader Complexity
2.1.6 HSR Optimize
2.1.7 Reduce unnecessary post-treatment
2.1.8 Mesh Instead of Alpha Test
2.1.9 Bandwidth bottleneck
1. Reduce Cache miss
2. Turn on mipmap
3. Use hardware compression format , Try to use a larger compression ratio in the acceptable range
4. Use the nine palace grid sprite Reduce UI Map size
5. Check the map , Avoid too large maps
6. Reduce Lightmap Size
7. Use Occlusion culling Reduce the render target
8. Use LOD grid
9. Use gpuinstancing Instead of mesh merging
10. Reduce resolution
11. Try to use constant registers gpu instancing
3 Memory
Memory allocation Mono33% texture 33% other 33%
3.1 Resource memory
3.1.1 texture
3.1.1.1 Texture compression format
consider ETC2,ASTC
3.1.1.2 Texture size
Can be small
3.1.1.3 mipmap
Generally used for scenes and characters , Memory will increase 1.33 times , Pay attention to that UI Invalid ,UI Don't open
3.1.1.4 Read & Write
Turning on read and write will double the memory consumption
3.1.1.5 Resource redundancy
Instantiate and modify materials 、ab Package policies and so on cause resources to occupy memory repeatedly
3.1.2 grid
3.1.2.1 Normal、Color and Tangent
Don't import unneeded attributes
3.2 The memory of the engine module itself
3.2.1 ab Package instance release
reasonable ab Package management policy , Avoid memory leaks
3.2.2 Reasonable component management
For abandoned objects, clean them up at the first time
3.3 Managed heap memory
3.3.1 Avoid allocating large amounts of unnecessary memory
Mono Virtual machine will not reduce memory consumption after we release memory , That is to say, only increase but not decrease , Avoid improving Mono Peak in memory .
3.3.2 Avoid allocating memory with high-frequency functions
Various update Be careful when allocating memory in
边栏推荐
- [test development methodology] experience of test development platform PK - choice
- c sqlite ... ...
- 【饭谈】如何设计好一款测试平台?
- At present, flynk CDC does not support mysql5.5. If you change the source code and release this restriction, there will be a lot of data problems?
- 2022 love analysis ― bank digitalization practice report
- ansible+Crontab批部署巡检
- [MAIXPY]kpu: load error:2005, ERR_READ_FILE: read file failed问题解决
- 【面试:并发篇24:多线程:综合练习】顺序控制
- YUV420 YUV420sp 图像格式「建议收藏」
- Six principles of C program design
猜你喜欢

How to implement distributed locks with redis?

【Flink】FLink RocksDBListState 报错 You cannot add null to a ListState

GPON介绍及华为OLT网关注册配置流程
![[leetcode ladder] linked list · 021 merge two ordered linked lists](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[leetcode ladder] linked list · 021 merge two ordered linked lists

Bitcoin.com:usdd represents a truly decentralized stable currency

分享|智慧消防应急管理平台解决方案(附PDF)

【面试:并发篇23:多线程:join】join再理解

Why do independent sellers like to do e-mail marketing? The original conversion rate can be improved so much!

五种分配方式是否会产生内部碎片、外部碎片

虚拟内存与磁盘
随机推荐
[51Nod1676 无向图同构]无向图哈希[通俗易懂]
Redis为何选择单线程?
[database] index
Does the open source agreement have legal effect?
性能调试 -- Chrome Performance
IJCAI2022开会了! 微软等《领域泛化Domain Generalization》教程
JSP初识
ansible+Crontab批部署巡检
Shopify sellers: share some tips for social media marketing!
Protobuf的简单使用
[interview: concurrent Article 23: multithreading: Join] re understanding of join
[redis underlying parsing] string type
ORIGYN基金会正式启动$OGY Staking,引领新一轮生态利好
[interview: concurrent Part 24: multithreading: comprehensive exercise] sequence control
Simple use of protobuf
这次龙蜥展区玩的新花样,看看是谁的 DNA 动了?
Why do independent sellers like to do e-mail marketing? The original conversion rate can be improved so much!
Redis master-slave architecture lock failure problem (master-slave)
How to configure and use rocksdb in the flinksql environment
文件无法保存(文件夹已损坏无法读取怎么办)