Unity Memory Profiler

download

Pull down Advanced in the Package Manager interface, select Show preview package , and enter:
Memory Profiler
insert image description here

use

Compared with the built-in Profiler, MemoryProfiler can provide detailed memory usage status. When analyzing memory, it is best to do the analysis on the target device . The memory usage in the editor will be very different from the running version, and the analysis tool may not be able to analyze it accurately.
Readers can demonstrate the difference between the effect on EditorPlay and the window/phone by themselves .
Here we will demonstrate the effect on the Window side.

Check the Developmenu Build and Autoconnect Profiler

As shown below, open project - BuildSetting, be sure to check the Developmenu Build and Autoconnect Profiler .
insert image description here

startcapture

Step1: Run the .exe file we successfully built above
insert image description here
Step2: Open MemoryProfiler
insert image description here
Step3:
If we checked the Developmenu Build and Autoconnect Profiler when we built it just now , and have run the .exe file, then we can select the following in MemoryProfiler Display:
insert image description here
Step4:
Click capture
insert image description here
and wait for a while and the following will appear:
insert image description here
Note: If we find that there is a texture memory problem, and we are running in the editor environment, we can modify the problematic texture without closing the running state, and then click again Take a shot to see the difference.

Tips for reducing memory usage

Reduce the global quality of textures

Open Project Setting, select Quality, and modify Texture Quality to halfRes. Note that all texture quality is modified here
insert image description here

Reduce the memory usage of a single texture

The above modification affects the whole world, if we only want to modify the memory of a certain texture. As shown below: Select the resource and modify MaxSize.
insert image description here

Close Read/Write

If the read/write option is enabled, the data will be kept in the cpu memory when it is sent to the GUP for drawing,
thus doubling the memory usage.
insert image description here

Compress sound resources

The PCM compression format is lossless compression, suitable for short sound effects. Long music needs to use the Vorbis lossy compression format to save memory.
insert image description here

Guess you like

Origin blog.csdn.net/qq_28644183/article/details/125411244