LoadLevelAdditive in reverse?

Hello,

Plain and simple I need to use Application.LoadLevelAdditive(“MyScene”); in my game but the problem is I can’t seem to find a way to destroy the scene when I’m done with it!?

In the case of objects like Lerpz etc I can create them as instanced and use destroy() on them when I’m done with them but I can’t figure out how to do this to a scene object. I’m not even sure it’s an object for that matter :? I’ve looked through the forum and script documentation to no success.

Please help me out!

You can make everything in a scene a child of a single object and destroy the object when you want to get rid of the entire scene.

Thank you for your quick replay and great suggestion!

But wouldn’t that still leave the scene file loaded in memory?

To understand better what I’m trying to do basically I’m paging terrain by additive loading it when I approach it. My overall terrain being broken into a collection of scenes etc… When I leave the terrain I’d like to destroy it so that its not bogging down the user anymore.

EDIT:

I have played around with your suggestion a bit and I got it to work… ie removing the scene etc… I’m still curious about my question though of using LoadLevelAdditive then deleting all th objects. Is there empty scene objects left floating in memory or does the whole thing get scrapped once it’s empty? Or when it loads it additive does it just load the objects from the scene only?

:lol: maybe Im just over thinking this :roll:

The suggestion that I passed along was based on feedback that I had to the same question and is apparently how things are being handled for several projects. As for anything being left in memory, someone with a more intimate knowledge of things behind the scenes would have to chime in on that, but this solution seems to work.

Scene files are mostly just a collection of objects with all their components attached and configured as saved. I forget if Render Settings are saved per-scene, but if they are loaded they just replace the current render settings, so no new memory is allocated.

Long story short: destroying all the objects in a scene is effectively “unloading” the scene.

How is this procedure supposed to relate to AssetBundle.Unload()?
It looks like assetBundle.Unload(true) would do the same thing - deleting objects from the scene…

The question wasn’t about asset bundles, so it is entirely unrelated