当前位置:网站首页>Unity foundation 5-optimization strategy
Unity foundation 5-optimization strategy
2022-07-28 20:55:00 【W.C.Zeng】
Reduce drawcall
drawcall Namely CPU towards GPU Interface for sending drawing commands , When objects of different materials are drawn on the screen , Need to be CPU Call the graph API ( OpenGL or direct3d ) Trigger graphics card drawing
- Static objects of the same material , stay inspector Window tick static
- Merge Atlas
Using atlas can avoid the gap between tiles - Algorithm optimization
…
GC Optimize
unity Using automatic memory management , It is divided into heap area and stack area , Memory reclamation in the stack area is fast , Performance optimization is mainly reflected in heap memory recycling .
Steps of heap memory allocation :
- Idle memory units are enough , No extra memory is allocated
- Trigger garbage collection , Get more spare memory units , Reallocate memory
- After recycling , Idle memory units are still not enough , Expand the size of heap memory , redistribution
Operation steps of garbage collection :
- Check every stored variable in the heap
- Whether the reference of variable is activated
- Inactive variables are marked as recyclable
- Remove the marked variable , Free memory
When to trigger garbage collection :
- When memory is allocated on the heap but there is not enough free memory
- Different platforms automatically trigger GC
- Enforcement GC
Optimization strategy
- Reduce GC Number of runs 、 Single run time
- Delay GC Running time of , For example, when the game pauses 、 Execute during scene switching GC
The specific methods
- Reduce heap memory allocation and reference allocation
- Reduce the frequency of heap memory allocation and recycling
- Objects that need to be generated and destroyed frequently , Using object pooling technology
other
- Avoid frequently creating strings
- Reduce packing operations
- In process operation , Avoid returning new parameters , for example
yield return new WaitForSeconds(1f);
边栏推荐
- PL515 SOT23-5 单/双口 USB 充电协议端口控制器 百盛电子代理商
- Space shooting Lesson 13: explosion effect
- Explain various coordinate systems in unity in detail
- Algorithm interview high frequency problem solving guide [1]
- Unity performance optimization scheme arrangement
- Talking about canvas and three rendering modes in unity
- Job CE
- JS drag and drop alert pop-up plug-in
- Explain mesh Collider in unity
- js图表散点图例子
猜你喜欢

Seventeen year operation and maintenance veterans, ten thousand words long, speak through the code of excellent maintenance and low cost~

Explain rigid body and collider components in unity

Talking about canvas and three rendering modes in unity

"When you are no longer a programmer, many things will get out of control" -- talk to SUSE CTO, the world's largest independent open source company
![[server data recovery] HP StorageWorks series storage RAID5 two disk failure offline data recovery case](/img/7c/d5643d27c2ca7a7aed4eb02fd81042.jpg)
[server data recovery] HP StorageWorks series storage RAID5 two disk failure offline data recovery case

Prometheus complete process of configuring alertmanager

Why on earth is it not recommended to use select *?

Redis 3.0 source code analysis - data structure and object SDS list Dict

Cartoon JS shooting game source code

想画一张版权属于你的图吗?AI作画,你也可以
随机推荐
GIS数据漫谈(六)— 投影坐标系统
远光软件获得阿里云产品生态集成认证,携手阿里云共建新合作
PostgreSQL数据库删库前是不是需要把所有连接断开才能删除?
到底为什么不建议使用SELECT * ?
What is data center? What value does the data center bring_ Light spot technology
Redis 3.0源码分析-数据结构与对象 SDS LIST DICT
Huawei cloud digital asset chain, "chain" connects the digital economy, infinite splendor
[工具类] Map的util包, 常用 实体类转化为map等操作
About the title of linking to other pages
Hangao database best practice configuration tool Hg_ BP log collection content
企业如何成功完成云迁移?
Space shooting Lesson 16: props (Part 2)
Unity performance optimization
The 678th operation
Network shell
Integrating database Ecology: using eventbridge to build CDC applications
Introduction to redis II: RedHat 6.5 installation and use
Yyds dry inventory interview must brush top101: every k nodes in the linked list are turned over
Alibaba cloud MSE supports go language traffic protection
算法面试高频题解指南【一】