Megacity why didnt use subscene load and unload?

Megacity why didnt use subscene load and unload?
I think that loading only the subscenes that can be seen in the camera view frustum is better in terms of memory management than loading all the subscenes. but MegacityDemo do not use Load & Unload Scene. only use LOD. is there Any reason not use to load & unload?

But they did unload and load Subscenes? Look for usages of the RequestSceneLoaded component.

Luxxuor To be clear, I’m not talking about the normal scenes, I’m talking about the subscenes of DOTS.

I haven’t loaded it in a while but I’m pretty sure Megacity was built with subscenes so we’re kind of not sure what you’re talking about?

1 Like

I know, and I was talking too about Subscenes. The mega city demo is using Subscenes and SubsceneSections for loading/unloading.

1 Like

i think need waht Loads or unloads when within the camera’s field of view for manage memory & performance . but megacity load All

It’s not realistic to expect scene loading to be fast enough to load scene sections based on the camera FOV. Games don’t usually do this - you’d get a lot of objects appearing out of nowhere when you look around (or extreme framerate drops if you do loading synchronously). You just can’t guarantee that the latency will be low enough.

In fact, I think DOTS subscene loads always take at least several frames (streaming from disk, staging the loaded entities, integration with the default world, loading related assets… all takes time). It definitely doesn’t seem feasible to load the subscene on the same frame as the player input.

2 Likes

Megacity is too small, so subscene loading/unloading based on distance doesn’t make much sense.
You’d never load/unload subscenes that are close, based on the camera frustum or rotation. There are better solutions for it when it comes to rendering.

1 Like

Each building is a subscene that is dynamically loaded/unloaded depending on the distance.
When unloaded you only see a low poly placeholder.

1 Like

@

thanks your answer
what is better solution for it when it comes to rendering? you mean lod?

i know too. megacity onliy use lod.

megacity is small. but megacity’s memory not small. for manage memory need load,unload subscene i think

Each building consists of thousands of individual meshes.

I don’t have a working copy of Megacity to check, but I don’t think the memory usage for entities/components themselves is all that big. Most of the memory would probably be occupied by meshes, textures, etc, and those are reused throughout the entire city, so you can’t free them anyway.

For a sufficiently large city you would probably need to start loading/unloading distant subscenes based on the player/camera position. If your city has interiors, you can try loading the interior subscenes when the player is close to the building, and unloading it when the player is far enough. If the interior is large enough and has no outside visibility, you could maybe even unload parts of the city while the player is inside.

I think for open world games with very high view distance you would also need some kind of subscene-level LODs (?) (I’m not entirely sure myself, I’m also interested in this topic)

1 Like

Apk your answer is unbelivable super pretty nice! It clearly solved several questions that I desperately wanted to know at once!! god! Super pretty!

resolved issues mentioned above
https://discussions.unity.com/t/873570
https://discussions.unity.com/t/872662/10

and finally this post also solved

1 Like