当前位置:网站首页>Idea of capturing mobile terminal variant combination
Idea of capturing mobile terminal variant combination
2022-06-30 05:31:00 【UWATech】
1) The idea of grabbing the variant combination of mobile phones
2) How to clear File.ReadAllBytes Resulting memory leak
3)atlas.GetSprite(name) Memory leak
4)Unity After version update Odin Plug in serialization error
This is the first 303 piece UWA Push of technical knowledge sharing . Today we continue to select and develop a number of 、 Optimization related issues , Suggested reading time 10 minute , If you read it carefully, you will get something .
UWA Question answering community :answer.uwa4d.com
UWA QQ Group 2:793972859( The original group is full )
Shader
Q: Questions about variant collection ,PC The end editor comes with its own collection , But after all, the running time is Editor Environmental Science , It is far from the real mobile environment .Warmup Only the combinations in the list will be preloaded , Not Shader All combinations of packages . So if the collected variant is not a real environment , It will only be wasted CPU And GPU memory , When the real rendering is performed, it is found that the combination submitted before is required by the non mobile end , Need to re Warmup.
also , If the quality is divided , For example, fine pictures turn on dynamic shadows , Smooth model off . This produces two sets of combinations . Theoretically, it should be divided into two SVC, and PC Yes, you can only save a list of all variants .
Sum up , I think the solution is to run the mobile phone in real time , Capture the usage data of the mobile phone , To divide into different lists , This should be the most authentic .
In order to realize this idea , You need to be able to find out how to get the submitted variant data , Known to be available in profiler-CPU-Timeline Mode of Shader.CreateGPUProgram Inside meta_data You can get it in there .

adopt CS Source code analysis to NativeProfilerTimeline This control is drawing Timeline The core of the class .NativeProfilerTimeline.GetEntryInstanceInfo This function can get the corresponding meta_data.
But this class is C++ It's written at the bottom ,C# It's just Draw To submit the drawing .GetEntryAtPosition Go to the mouse position to get Entry, Code cannot be reflected to EntryIndex. Now we are in a dead end .
Do you have any solutions or new ideas ? It's best to get a list of variations on your phone .
A: Can be in Graphics Check this on the panel Log Shader Compilation:
Under the editor Console Connect the real machine , So you can trigger Shader.CreateGPUProgram See the corresponding Log:
Autoconnected Player Compiled shader: Unlit/TestShader, pass: , stage: all, keywords FOG_EXP2
Thank you Zong Huixuan @UWA The Q & a community provides answers
Memory
Q: Recently, the project has been playing for a long time , Memory keeps exploding . During the inspection , I found that one was used in the game File.ReadAllBytes Method to read several 5~10MB Unequal binary data , After loading, the data has been copied null, however Mono Still growing , call GC Can not be released .

Theoretically, this array has not been referenced by the business layer . however , use Memory Profiler see , The memory is still . Please consult , Does anyone know how to clear it ?
Unity edition 2019.4.9

A1: Buffers don't have to... Every time new One .
thank [email protected] The Q & a community provides answers
A2: If it is Mono Version of APK, You can try IL2CPP. If IL2CPP The version does not have this problem , Should be to encounter Mono Of Bug 了 , Allocate more heap memory at one time , There is a probability that the allocated heap memory cannot be reclaimed .
thank [email protected] The Q & a community provides answers
A3:Boehm GC Caused by its own defects , You can search for BlackList, If there is source code , There are many ways to avoid or minor modifications ; If there is no source code, you can try :
1. Reduce... In the dictionary Struct When Key;
2. Remove small files , rewrite File The interface of , Reuse memory .
thank [email protected] The Q & a community provides answers
Script
Q:Unity edition 2019.4.23, Found in frequent calls atlas.GetSprite(name) Memory leaks when , Increase or decrease , Until it collapses ! Has anyone ever encountered this problem ? Is there any good solution ?
A1: If you don't consider the engine itself Bug Under the circumstances , Most memory leaks are caused by references that are not handled properly . Some places may still use these resources , It's just not relevant , As a result, this part of resources cannot be recycled . Therefore, you can focus on checking these functions first .
Thanks to Liao Wuxing @UWA The Q & a community provides answers
A2:
//
// Abstract :
// Clone the first Sprite in this atlas that matches the name packed in this atlas
// and return it.
//
// Parameters :
// name:
// The name of the Sprite.
public Sprite GetSprite(string name);According to this passage Clone, That is to say, every call GetSprite, Will perform a clone operation , And will not automatically release .
Then you need to use the management script to create a buffer pool , Repetitive Sprite Get it directly from the pool . And release from the script when releasing .
Dictionary<string, Sprite> mSpritePool = new Dictionary<string, Sprite>(); public Sprite GetSprite(string key, SpriteAtlas source) { Sprite result = null; if(!mSpritePool.TryGetValue(key, out result)) { result = source.GetSprite(key); if (result != null) { mSpritePool.Add(key, result); } } return result; }You can also do SpriteAtlas Storage of key value pairs of objects , Easy access and release .
thank [email protected] The Q & a community provides answers
Script
Q:Unity After version update Odin serialize , After version update , from 2020.3.21 Update to 2021.3.41 This problem occurred after .

A:Odin The warehouse has a similar problem , stay 3.0.13.0 Version fixed , Try upgrading the plug-in version :
https://bitbucket.org/sirenix/odin-inspector/issues/843/error-with-serializedmonobehaviour-on
Thank you Yufei @UWA The Q & a community provides answers
The cover map comes from the Internet
Today's sharing is here . Of course , There is no end to life but to know . In the long development cycle , The problems you see may be just the tip of the iceberg , We are already in UWA The Q & a website has more technical topics waiting for you to explore and share together . You are welcome to join us , Maybe your method can solve other people's urgent needs ; And he's a mountain “ stone ”, Can also attack you “ jade ”.
Official website :www.uwa4d.com
Official technology blog :blog.uwa4d.com
Official Q & a community :answer.uwa4d.com
UWA School :edu.uwa4d.com
Official technology QQ Group :793972859( The original group is full )
边栏推荐
- Unity- the camera follows the player
- Promise知识点拾遗
- 14x1.5cm竖向标签有点难,VFP调用BarTender来打印
- 如何制作CSR(Certificate Signing Request)文件?
- /Path/to/ idiom, not a command
- Unity screenshot method
- [Blue Bridge Road -- bug free code] analysis of AT24C02 storage code
- Unity gets the resolution of the game view
- AI大模型落地大考,浪潮交出了怎样的答卷?
- The file has been downloaded incorrectly!
猜你喜欢

如何制作CSR(Certificate Signing Request)文件?

C语言基础小操作

Chinese pycharm changed to English pycharm

OpenCL线程代数库ViennaCL的使用

【LeetCode】Easy | 225. Using queue to realize stack (pure C manual tearing queue)

Unity ugui text value suspended enlarged display add text background

East Tower attack and defense world - XSS bypasses the safety dog

86. 分隔链表

Digital signature——

VFPBS上传EXCEL并保存MSSQL到数据库中
随机推荐
Solidity - 安全 - 重入攻击(Reentrancy)
uboot通过终端发送‘r‘字符读取ddr内存大小
Nestjs introduction and environment construction
虚析构和纯虚析构
C # uses monopinvokecallback to directly call back C # function
Responding with flow layout
Intellj idea generates jar packages for projects containing external lib to other projects. The method refers to the jar package written by itself
RedisTemplate 常用方法汇总
Unity publishing /build settings
Rotating frame target detection mmrotate v0.3.1 training dota data set (II)
Unity mobile end sliding screen rotation
Delete the repeating elements in the sorting list (simple questions)
网络变压器怎么判断好坏?网络滤波变压器坏了一般是什么症状?
Introduction to Redux: initial experience of Redux
Xi'an Jiaotong 21st autumn online expansion resources of online trade and marketing (III) [standard answer]
Is it safe to open an account and trade with a compass?
旋转框目标检测mmrotate v0.3.1入门
Xi'an Jiaotong 21st autumn "computerized accounting" online homework answer sheet (I) [standard answer]
mmcv常用API介绍
Unity shader flat shadow

