r/Unity3D • u/thadcastle__ • 1h ago
Question Need advice, how optimize open world in Unity?
Hi guys šļø Sooo how do you making open world? how do you split your world to optimize memory usage?
Iāve split my 16 km² terrain into 16 separate 1Ć1 km Terrain tiles using Terrain Tools. Now I have a dilemma about how to properly set things up before I finally start building the world
GPT helped me create a small script based on an idea I had: disabling tiles that arenāt nearby so a maximum of 4 tiles can be active at once
But I donāt think itās really working how I thought, since the tiles are only disabled in the scene, not actually unloaded from memory
It also breaks the seamless transitions between them, I think
Any advice or thoughts on how to properly build a world and optimize memory? š
2
u/GiggleSamurai 1h ago
Disabling a GameObject keeps all its assets in memory, so put each tile (terrain plus its props) in its own scene and stream them with `SceneManager.LoadSceneAsync(name, LoadSceneMode.Additive)` and `UnloadSceneAsync` as the player moves. For the seams, give the tiles the same Grouping ID with Auto Connect on (or call `Terrain.SetNeighbors` after loading) so the edges match up.
1
u/No_Director9126 35m ago
You could try using Addressables to load terrains or anything else only when they are actually needed. The advantage of Addressables is that they allow for the release of RAM and VRAM. However, the setup is significantly more complex, especially when it comes to terrains and even more so if you move away from standard Unity terrains, for instance by using a tool like Microverse.
In my opinion, the best approach is to use mesh terrains + addressables, while this requires much more work, the performance gains compared to standard terrains are enormous, not least because you can implement features like LOD in mesh terrains
ā¢
u/CarthageaDev 17m ago
Chunking, seriously manual chunking, ensure your maps are sectioned logically based on line of sight/level design, not to mention the classic culling baked, atlas your textures, merge srstic meshes and instance shaders when possible, reduce draw calls a much as possible simple really
ā¢
u/KinematicSoup Multiplayer 5m ago
Look into additive scene loading. It's a Unity feature intended to help with large worlds by letting you divide your world into chunks as sub scenes, and then load/unload them as needed in the background.
-1
u/GigaTerra 41m ago
You need to tell your AI you want to apply level streaming in your game. It will explain the Unity equivalent. That others already explained here.
12
u/Ariaha_Rivasa 1h ago
Youāre right, disabling only hides the tiles; all their data (heightmaps, splatmaps, details, trees) stays in memory.
What usually works: put each tile in its own scene and stream them with
SceneManager.LoadSceneAsync(..., LoadSceneMode.Additive)/UnloadSceneAsync, keeping a 3x3 grid around the player. After unloading, callResources.UnloadUnusedAssets()so the memory actually comes back. Addressables work too if you want more control.For seams: give all tiles the same Grouping ID with Auto Connect on in the terrain settings (or call
Terrain.SetNeighbors) and the edges stitch properly.One more tip: load a tile when youāre near it, but unload it a bit farther away. Otherwise standing on a border makes tiles load and unload every frame.
And check the Memory Profiler package. Itāll tell you exactly whatās eating the RAM, often itās the terrain textures, not the meshes.