当前位置:网站首页>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
边栏推荐
- Create files, file permissions, ownership, and sticky bits
- GPON介绍及华为OLT网关注册配置流程
- 919. Complete binary tree inserter: simple BFS application problem
- IJCAI2022开会了! 微软等《领域泛化Domain Generalization》教程
- [Flink] flick rocksdbliststate reports an error you cannot add null to a liststate
- 5、 Pinda general permission system__ PD tools XXS (anti cross site script attack)
- 【饭谈】如何设计好一款测试平台?
- 6-17漏洞利用-反序列化远程命令执行漏洞
- Create EDA - why should I learn EDA
- [hand torn STL] unordered_ set、unordered_ Map (encapsulated with hash table)
猜你喜欢

Bitcoin.com:USDD代表了真正去中心化稳定币

【leetcode天梯】链表 · 876 查找链表中间结点

Redis usage details

2 lines of code to generate a solid desktop background

919. Complete binary tree inserter: simple BFS application problem

Bitcoin.com:usdd represents a truly decentralized stable currency

Lichuang EDA -- creation of devices 01 resistance (II)

信息安全建设原则指导

Open source RSS subscriber freshrss
![[Fantan] how to design a test platform?](/img/54/5aca54c0e66f8a7c1c3215b8f06613.png)
[Fantan] how to design a test platform?
随机推荐
新版Maixhub部署(V831与K210)
The reisson distributed lock renewal failed due to network reasons, resulting in the automatic release of the lock when the business is still executing but the lock is not renewed.
Bitcoin.com:usdd represents a truly decentralized stable currency
Excuse me, how to deal with repeated consumption of MySQL data
Naming rules for BSP of Quanzhi chip
I/o case practice
Unity metaverse (II), mixamo & animator hybrid tree and animation fusion
How will Web3 change the future of people?
【面试:并发篇24:多线程:综合练习】顺序控制
[hand torn STL] unordered_ set、unordered_ Map (encapsulated with hash table)
How to implement distributed locks with redis?
Golang: MVC models
Redis master-slave architecture lock failure problem (master-slave)
Jmeter---设置代理录制请求
Lichuang EDA -- creation of devices 01 resistance (II)
sql语句练习题整理
Jmeter--- set proxy recording request
【Flink】FLink RocksDBListState 报错 You cannot add null to a ListState
[leetcode ladder] linked list · 876 find the middle node of the linked list
Come again