Large, seamless environments

I’m familiar with using separate scenes for separate “levels” in Unity, but I’d like to create an open-world game with large, seamless terrains, as seen in Elder Scrolls, WoW, etc. Is this feasible in Unity?

not is eazy for that use script to teleport and lvl load system :smile:

Is each “chunk” of land a separate scene? Are there any examples of this being done?

You can have multiple terrains in your scene, and turn them on and off as they get closer. The challenge might be, let’s say you are near a big zone…like barrens in WoW. You would probably want to split the zones into multiple terrains themselves, so you can show the close terrain in high detail…but the further part in low detail, or not at all. Depends on how far the player view is.

If you want to get a little fancier…you may just store the terrain data locally instead of in the Unity scene, and just have like…5 terrains in the scene. As you move around, you would load the zone data into those 5 terrains, surrounding the player. So, let’s say the game gets BIG, and you need hundreds of terrains. It might be too much to have loaded up in memory all the time, so you just only have 5 at one time and you put the terrain data in them as the player runs around.

Then of course you have to store all the terrain data…trees, grass, etc. So, the more dynamic and flexible your system becomes, the more work you get to do :slight_smile:

1 Like

So would the advice be to have multiple, unrendered environment objects in the scene and only enable rendering when the player is within a certain radius? Wouldn’t this be quite a performance hit as every gameobject would have to be calculating the player’s distance at every update?

You would group them together and use one object to control visibility of a group.

This is what I’m now doing, and it’s working quite well in keeping memory usage down, however it still takes a while for the scene to initially load due to the large amount of gameobjects.

The way I’m doing it, is calling myTransform.gameObject.SetActive(false) on Start() and then making them active when the player reaches a certain radius. However, is there a way to have them as inactive by default so the scene won’t load them at first load?

Yes - Application.LoadLevelAdditiveAsync

Using this, you can load each terrain scene and add it to the current scene as needed.

This works well. Does anyone have any tips for actually aligning the terrain up when they’re in different scenes?

Design the base scene with all the terrains in it, use StitchScape to make sure they are all stitched together right, and then go through the process of deleting and saving.

This is working well so far. I’m putting each scene in its own gameobject, then disabling the gameobject if the player moves too far away from it to conserve memory.

My question now is, does setting a gameobject as inactive unload all the child resources (materials, textures etc) from memory?

Setting a gameObject to inactive (I believe) just makes it so it’s not rendered and it’s components are “put to sleep” (no updates, no messages sent to them, effectively not in operation). No resources should be unloaded from memory when a gameObject is made inactive.