当前位置:网站首页>Small knowledge points of asset
Small knowledge points of asset
2022-06-23 02:04:00 【Thunder Gazi】
1. Wavy lines
When the end of the folder is ~. He will not display in the project .


2.DisableWriteTypeTree Use
Unity In order to make the new version compatible with the old version Assetbundle, Complete settings will be made when packaging . For example, the previous version recorded a lot of data, but the new version was not used .. When the new version is packaged, the data will still be written in by default , Let the old version also work . therefore bundle It will be a little bigger

It uses a very simple Cube package , Generated with the first Bundle yes 39KB. The second is 26KB. Their memory usage at run time is also very different . So if the project is sure not to change the version for development and use DisableWriteTypeTree Packaging reduces package size and memory usage . The author has also experienced 6、7 It's a project , At present, there is no project that has been online, and a new version should be used unity Iterative development .
3. When the same resource is loaded asynchronously and synchronously in the project , The practice of our project is to synchronize directly in asynchrony load To solve .
4.Unity Why is it that setting resources in a project does not change the properties of the file itself , The reason is that the import project will generate a copy of the resources in Library in .Unity Reading is actually Library Resources for .
There was a problem in the previous project , It is wrong to import a shader into a new device no matter how you change it . Later, I took other people's Library Just copy the resource .
5. Officials say that if you want to do a hot update in the project , Many of them are generated AssetBundle In the process of MD5 The record of . This can sometimes be wrong , Maybe two identical files have different versions , Generated MD5 Are not the same as . Recommended in build AssetBundle Go ahead MD5 Record , Or lazy Just use the generated AssetBundle There are Hash Value to record .
6. When there is a sound in the project, the large sound delay in the real machine is likely due to the DSP buff The setting is too large . His principle is that the trigger sound will be added to the cache and wait , Wait until the buffer is large enough to play . This reduces communication with the sound card , But the problem is as mentioned above .
7. If our code writes multiple generics Such as <T,U,X,Z> And so on. , Be sure to pay attention to constraints . Because his implementation will generate a stack of permutation overloads at compile time , Suppose the coefficient of a term is 10 individual , that 4 Item will appear 1000 One such overload . That's pretty efficient .
8.Resource Don't put too many resources in it , Because a non uninstallable red black tree will be generated inside , So as to occupy memory .
9. Official recommendation LZ4 compression technique , The speed is almost Lzma Of 10 times , But the compressed volume will be higher than 30%,trunk-base Compression mode of , When decompressing, you can reduce the memory consumption , Because there is no need to unzip the entire file , Unzip each trunk When , You can reuse buffer( In the China enhanced version, a LZ4 Of AssetBundle encryption )
10.Texture
1.upload buffer
and DSP buffer similar , Is how much to fill Texture Data time , towards GPU push once
2.r/w
Do not open it if it is not necessary , One Texture The normal loading process is
Load into memory -> analysis -> upload buffer -> From memory delete
After the option is turned on , Not from memory delete, As a result, both memory and video memory have a copy ( notes : Looks like iOS There won't be two , Instead, use a virtual pointer , Point to the same piece of data , The details can be verified )
3.mip maps
for example UI Don't open these , Also reduces memory footprint
11. We use Unity It made me feel Unity The memory you eat won't spit out . It actually spits out , But the conditions are hardly met , want 6 Time GC You will not return until you have accessed it . Therefore, in the project, it is still calculated as if you can't spit out after eating . Because its memory structure is not compact , So the sequence of loading and unloading resources is very important .
For example, I now uninstall 2 individual 5MB Resources for , It is not continuous in the memory area , At this time, I want to load a 8MB Resources for . I'm sorry , this 2 individual 5MB Can not meet this condition , So an extra one will be created 8MB To store this resource , This leads to waste .
But if the memory area is unloaded at this time 10MB Resources for , So this 8MB Our resources will be crammed in . There is no extra waste .
In view of this , Projects can first unload resources that occupy a large amount of memory , Then load small resources instead of vice versa .
12. About closures and anonymous functions , During the operation period, there will be new A new object comes out , Do not release until the object is released . Cause some unexpected waste .
边栏推荐
- Data analysis method - user group analysis
- Quick sort method
- Analysis of current mainstream video coding technology | community essay solicitation
- //1.16 getchar function
- There are animation characters interacting with each other when the mouse slides in the web page
- 1. Mx6u bare metal program (1) - Lighting master
- await is only valid in async function
- //1.14 comma operator and comma expression
- //1.15 putchar function
- C. Number of Pairs-Codeforces Round #725 (Div. 3)
猜你喜欢

An interesting example of relaxed memory models

1. Mx6u bare metal program (1) - Lighting master

Freshman C language summary post (hold change) Part 2 formatted monthly calendar

Analog Electronic Technology

Nebula operator cloud practice

Three methods for solving Fibonacci sequence feibonacci (seeking rabbit) - program design

Third order magic cube formula

Google account cannot be logged in & external links cannot be opened automatically & words with words cannot be used

There are animation characters interacting with each other when the mouse slides in the web page

Component development
随机推荐
C language games: sanziqi (simple version) implementation explanation
Thread local storage understanding
Analysis of current mainstream video coding technology | community essay solicitation
Classical questions of function recursion
Analysis of web page status code
Chapter 3 tensorflow linear regression
On AI and its future trend | community essay solicitation
Modulenotfounderror: no module named 'rospy', PIP could not find the installation package
await is only valid in async function
Single chip microcomputer (STC series 8051 core single chip microcomputer)
JS request path console reports an error failed to launch 'xxx' because the scheme does not have a registered handler
2022-1-12
Summary of the first week of winter vacation
Google account cannot be logged in & external links cannot be opened automatically & words with words cannot be used
C. Diluc and Kaeya——Codeforces Round #724 (Div. 2)
"Initial C language" (Part 2)
Foundation Consolidation - Flex width is content width
Debian10 LVM logical volumes
Rebirth -- millimeter wave radar and some things I have to say
How are pub and sub connected in ros1?