Monitor and reduce project memory usage
Check how much memory the Unity Spark editor uses, check whether your published game fits on phones, and reduce memory use with the assistant's help.
Read time 5 minutesLast updated 3 hours ago
Monitor memory in Unity Spark to keep the editor running smoothly and to make sure your published game runs on the devices you target, such as phones.
Unity Spark tracks the following kinds of memory:
- Editor memory: How much memory the editor uses in this browser tab, against a 4 GB limit. If the editor reaches the limit, the game engine in the tab stops.
- Published game on phones: An estimate of how much memory your published game needs on a phone, against the memory a phone gives a webpage. Unity Spark shows this estimate only if your project targets phones.
Check memory use
The memory reading in the bottom-right corner of the Scene view shows how much memory the editor uses, as a number and a small bar. If your published game is close to or over the phone limit, a phone icon also appears next to the reading.
The memory reading changes color as the editor gets close to its limit.
Color | Condition |
|---|---|
| Neutral | The editor uses less than 70% of its limit. |
| Yellow | The editor uses 70% or more of its limit. |
| Red | The editor uses 90% or more of its limit. The Memory details display |
To open the Memory details, select the memory reading. The details show the following information:
- The editor's memory use against its limit, and the Peak for this session.
- A bar that splits memory use by type, such as Textures, Meshes, Audio, Animation, Engine, and Other. A hatched Free until reload segment shows memory that a reload frees.
- The phone estimate under Published game on phones, for example, If the game is close to the limit or over it, Unity Spark also lists the assets that use the most memory on phones.
Fits on phones. 300 MB left. - The assets that use the most memory, under Heaviest in this scene and In project, not in scene. Select an asset to select its copies in the scene, or to locate it in the Project window.
Choose a target device
The target device decides whether Unity Spark checks your published game against the memory a phone allows. It doesn't change the editor's limit.
By default, a project targets Phones and desktop.
To change the target for the current project:
- Select the memory reading to open the Memory details.
- Next to Runs on, select the current target.
- Select Phones and desktop or Desktop only.
If you select Desktop only, Unity Spark hides the phone estimate and doesn't warn you when the game is too large for a phone.
Reduce memory usage
To reduce memory usage, use one or more of the following methods.
Ask the assistant to reduce memory
The Memory details include a button that asks the AI assistant to reduce memory use.
To ask the assistant to reduce memory:
- Select the memory reading to open the Memory details.
- At the bottom of the details, select the Ask button. The button's label depends on what needs attention, where is the name of the agent in your current conversation:
name- Ask to reduce: The editor uses a lot of memory.
name - Ask to free space: The published game is close to the phone limit.
name - Ask to fit under
name: The published game is over the phone limit, wherelimitis the phone limit.limit
- Ask
- In the Chat window, review the request. Unity Spark adds your current memory use and the largest assets as context, so the assistant knows where to start.
- Send the request.
Reload to free memory
The browser keeps the memory that a session has used, even after you remove assets, until you reload. The Peak in the Memory details shows the highest reading this session.
After you remove assets, the Memory details show how much memory a reload frees. To free it, select Reload scene. To decide later, select Later.
When the editor uses 90% or more of its limit and reloading can free memory, the Chat window displays . Select Reload page to reload the browser tab. Your work is saved. To hide the message, select Not now. It appears again if memory use keeps growing.
This browser tab is almost out of memoryIf the assistant has a plan in progress, the message includes Continue the plan after the reload, which is selected by default, so the assistant continues from where it stopped. To reload without continuing, clear Continue the plan after the reload.
You can't reload while the assistant is working, while the game is playing, or while your latest edits are still saving.
Remove or shrink large assets
To reduce the memory that assets use, try the following methods:
- Remove unused assets: Assets listed under In project, not in scene still use memory. Delete the assets you don't need from the Project window.
- Lower texture resolutions: Reduce the resolution of large textures in your project.
- Check before you import: The Asset Browser window shows how much memory an asset adds after you import it. If your project targets phones, it also warns you when an import brings your game close to the phone limit or over it.
Test on target hardware
If your published game is close to or over the phone limit, test it directly on the phones you want to support.
To test your game on a phone:
- Publish your game to Unity Play. Refer to Publish your game.
- When the publish finishes, scan the QR code in the Publish dialog with the phone to open the game.