download
Pull down Advanced in the Package Manager interface, select Show preview package , and enter:
Memory Profiler
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 .
startcapture
Step1: Run the .exe file we successfully built above
Step2: Open MemoryProfiler
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:
Step4:
Click capture
and wait for a while and the following will appear:
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
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.
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.
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.