当前位置:网站首页>Idea of capturing mobile terminal variant combination
Idea of capturing mobile terminal variant combination
2022-06-28 17:16:00 【UWA】
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 , Welcome to community communication :
Unity After version update Odin Serialization problem -- UWA Question and answer | Game developer interactive Q & a community | Tiger Technology
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 , Welcome to community communication :
Unity After version update Odin Serialization problem -- UWA Question and answer | Game developer interactive Q & a community | Tiger Technology
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 , Welcome to community communication :
Unity After version update Odin Serialization problem -- UWA Question and answer | Game developer interactive Q & a community | Tiger Technology
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 :
sirenix / Odin Inspector / issues / #843 - Error with SerializedMonoBehaviour on domain Backup (Unity 2021.2.16f1) — Bitbucket
Thank you Yufei @UWA The Q & a community provides answers , Welcome to community communication :
Unity After version update Odin Serialization problem -- UWA Question and answer | Game developer interactive Q & a community | Tiger Technology
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 )
边栏推荐
- NoSQL redis configuration and optimization (I blew the night breeze of Qinhuai River for you when you were not in Nanjing)
- This simple little function saves 213 hours for our production research team in half a year
- 55. maximum sum of continuous subarrays
- It's completely cold! Tencent's well-known software was taken off the shelves, and netizens were all sobbing...
- 「杰伦熊」暴跌96.6% 明星带货NFT为何遇冷?
- 提升可观测性 - 业务指标监控实践
- Monitoring remote host with cacti+spine in rhel6.4
- Metaq installation deployment document
- MySQL high availability MHA (accidentally passed my youth)
- Tianyi cloud web application firewall (edge cloud version) passed the first batch of trusted authentication
猜你喜欢

使用Karmada实现Helm应用的跨集群部署

Introduction to LTSpice circuit simulation

Log management in MySQL log backup and recovery

Q: how bad can a programmer be?

It's completely cold! Tencent's well-known software was taken off the shelves, and netizens were all sobbing...

这个简单的小功能,半年为我们产研团队省下213个小时

ICML 2022 | 基于解耦梯度优化的可迁移模仿学习方法

Redis持久化(少年一贯快马扬帆,道阻且长不转弯)

Tianyi cloud web application firewall (edge cloud version) passed the first batch of trusted authentication

Redis持久化(少年一貫快馬揚帆,道阻且長不轉彎)
随机推荐
Differences between shared hosts and WordPress hosts
MySQL high availability MHA (accidentally passed my youth)
Monitoring remote host with cacti+spine in rhel6.4
提升可观测性 - 业务指标监控实践
Introduction to PMD source code analyzer
[tcapulusdb knowledge base] how webclient users read and modify data
It's completely cold! Tencent's well-known software was taken off the shelves, and netizens were all sobbing...
【每日3题(2)】最大升序子数组和
Redis持久化(少年一贯快马扬帆,道阻且长不转弯)
The processor of this virtual machine supports different functions than the processor of the virtual machine that holds the state of the virtual machine
'summary of common network protocols' summarized by Tsinghua leaders in 3 days
How to open a futures account? Where is it safer to open a futures account?
软件快速交付真的需要以安全为代价吗?
RHEL6.4中使用Cacti+Spine监控远程主机
How to solve the problem of Caton screen when easycvr plays video?
In rhel6.4, cacti+spine monitoring host is used to send email alarm
Which securities company is better and safer to choose for opening an exchange fund account by mobile phone
ICML 2022 | transferable imitation learning method based on decoupling gradient optimization
天翼云Web应用防火墙(边缘云版)通过首批可信认证
Super detailed steps for MySQL master-slave switching

