Scene (or level) structure

I’m wondering what is the actual scene object that is loaded when LoadLevel is called. I’ve found no documentation at all as to the structure of scenes.

While I’m sure it isn’t possible, I’d love to be able to create scenes at run time, but just understanding the object hierarchy would be helpful in navigating my objects. What holds all the game objects in a scene? Is there a root object that is hidden?

The scene object you load is simply a scene you have created in your project via the editor. Go to file->new scene to make one. You can make as many as you like.

A scene is simply a collection of game objects. I guess you could call the scene the root object.

Not sure if you could create a scene at run time but I cant think of a reason you would want to.

If you think of a game with lots of levels or stages each of these would be best placed in its own scene and loaded as needed. If your game does not having any levels in the conventional sense, like a city building game then you could just have one scene for the start menu and one for the game.

you could have a blank scene with no objects and use resources.load to add your objects?

Actually you would need 1 object to attach your code too :slight_smile:

We just make sure there is a root game object in the scene with a “Level” entity script on it which we can call using our entity system.

To unload the level… just kill the gameobject

I am working on a City Builder, so it’s funny that was mentioned.

I’m trying to get the game to have a continuous Region where all the cities are located. While in Region Mode the player will click a city and load that city for play.

At this point I want to minimize the number of game objects loaded, which includes terrain segments and other city object collections. The current city is the only one that is simulated. The engine will need some basic data from cities close by. But I’d like to figure out a way to create that city as it’s own level dynamicaly and only load the resources I need. The terrain tiles the city is on, plus all the neighboring tiles, all the building and transit assets the city uses as well as other little things that make up a city. While the city is in play the border of the city can expand, and if it expands into a neighboring terrain tile I need to load a new neighbor for that tile.

So on the top level, my object system I had in mind was something like this:
Region (Scene)
=> contains highly LOD’d and baked city meshes viewed from a very high altitude

Clicking and loading a city would then load a scene specific to that city:
City
=> References the region data for terrains and low poly neighboring city data to create a skybox dynamically showing the ‘horizon’ silloettes of distant skylines.

When a player creates a new city, a new Scene would be created for that city and the appropriate assets it will need.

Make sense or am I totally off base?

I’ve read and read and found no references to a scene’s object heirarchy. Is there some hidden root object for the entire scene? If I dynamically load an asset during run time, where do I put its reference? Is there some master list of game-objects? The renderer has to iterate through objects somehow to call their Update() routine. How does it know what is loaded?