Optimization guide
- ZEPETO is structured to preload resources used in the world into memory.
- Based on 1.7.0 in the world, the lowest specification devices are iPhone 8 (2GB RAM) and Galaxy S8 (4GB RAM).
- Therefore, we need to make it so that it does not exceed 2GB.
- The minimum specification equipment may be changed later.
- In the case of a multiplayer world, the memory should be managed considering the maximum number of people because each character has memory.
- Please use the official Runtime Profiler officially provided by ZEPETO.
📘 Please refer to the following guide. [Runtime Profiler]
How to check performance indicators for World Multiplayer servers in your local development environment
If you are using VS Code as a script editor, you can check various performance indicators such as CPU usage, memory usage, and more for your local development environment server through the plugin.
📘 Please refer to the following guide on how to set up VS Code as a script editor in Unity.
1) Search for and install Flame Chart Visualizer for JavaScript profiles in the [Extension] panel on the left side of the VSCode screen.
- The performance indicators of the local development environment checked by the plugin may differ from the actual service environment. Please use it to understand the approximate performance trends and potential performance issues of the world multiplayer server logic.
- If VS Code's working directory is not set to the world project, the plugin will not work correctly. Be sure to select the correct project folder in the [Explorer] panel.
2) Go to the [Run and Debug] panel in VS Code and change the Debugging type to Zepeto Multiplay Script.
3) Press the Play button on the Unity screen to run the world, and press the [Start Debugging] button in VS Code to start runtime debugging.
You can check the performance indicators of the multiplayer server in real time in the [Run and Debug] panel.
👍 TIP
- You can add the following performance indicators by clicking the Toggle visible performance charts button in the [Run and Debug] panel.
- CPU Usage
- Heap Used
- Heap Total
- Resident Set Size
- External Memory
- ArrayBuffer Memory
Please optimize according to the following criteria to ensure the world released operates on the minimum specifications.
- Minimum specification device (with 2GB RAM) crashes when:
- Runtime Profiler > Allocated Memory exceeds 550MB on average.
-
- When the World is actually running, not only the World resources but also various processes are running in memory, so it is recommended to leave some space in the Allocated Memory.
- For multiplayer Worlds, there is a memory allocation per character, so you need to manage memory based on the maximum number of players.
- Average memory per ZEPETO character: 35MB
- If you use a mannequin of the ZEPETO character type, it occupies the same memory as when one Zepeto character enters.
- For optimization purposes, we recommend using the Simple type of mannequin if possible.
- Average of 280MB when up to 8 people enter
- These are average figures; please test your Allocated memory by actually having the maximum number of people enter before launch, if possible.
- The maximum FPS limit is 30FPS.
- Package capacity is limited to up to 1GByte.
- With the cross-world movement feature provided by World 1.8.0, you can indirectly resolve the capacity part.
- Please refer to the information related to Unity optimization.
- Please delete unused package folders and unused files as well.
- Please adjust the number of objects in the project and the number of trees/pools in the terrain.
- Using Coroutines: yield doesn't produce garbage, but making new waitForSeconds will produce garbage. Therefore, create and use the objects.
- In Update ( ), the parts that do not need to be called every frame are replaced so that they can be called every n frame.
- Avoid calling heavy logic functions in Awake( ) OnEnable( ) Start( ).
- Avoid leaving Update ( ) and LateUpdate ( ) even for empty functions.
- Avoid adding components at runtime. If necessary, it is more efficient to instantiate the prefab.
- GameObject.Find, GameObject.GetComponent, and Camera.main are expensive, so do not call from Update() but call from Start() if necessary.
- Instantiate and destory produce garbage and garbage collections to slow down the process. Instead, try to reuse it with pools.
- Renderer.material uses Renderer.sharedMaterial whenever possible to access the bound object's material since it is too expensive to make a new copy and return it.
- Depending on the purpose, divide the canvas and set the canvas that is not used as invisible.
- Limit the GraphicRaycasters and clear the Raycast Target. Erase the GraphicRaycaster from the canvas and insert the Graphic Raycaster separately into individual elements, such as buttons.
- If you don't need Raycast Target in text or images, delete it.
- Avoid using Layout Groups unless it is a Dynamic UI. Use the anchor to organize it.
- Large List and Grid Views are expensive, so avoid using them.
- When using the full screen UI, hide everything except this canvas. It eliminates the need for the camera to render the 3D scene. It also hides unnecessary canvases.
- Lower the Application.targetFrameRate because you do not need to update every 60 fps when using the full screen UI.
- Don't leave a blank space for the render camera of the canvas that uses World Space, and fill it in with the camera you use.
- If you leave a blank, Unity will automatically fill in the camera.main.
- Change the sound clip to mono.
- Enables the use of WAV file. Any compressed music file will be decompressed and then re-compressed during the build time. The quality of the music file is degraded during this process.
- Compress the clip and lower the compression bit rate.
- Use most of the files with Vorbis, and change the short sound to ADPCM.
- Do not exceed 22,050 Hz.
- Select the appropriate load type.
- For music files with size 200 kb or less, Decompress on Load.
- For music files with size 200 kb or more, remain Compressed in Memory.
- Set large file and background music to set to streaming.
- Muted music files do not end by simply changing the volume to zero, so make sure that they are destroyed.