Game Level question, instantiate or loadlevel?

I am nearing the final stages of a game I have been working on for a while now and have a question to the veterans here who can point me to a choice of how to handle my levels…

The game will have a large amount of levels through it’s lifetime, more than 100+.

I currently have everything needed to play any level in a cache system that pools objects and makes good re-use of them without any destruction…

The level data, on the other hand is the question.

I have a few choices here, but am tending to lead to a simple instantiate of the game levels. The “level” is a prefab that hold gameobjects with a script on it that has a pathing system, movement info, points, etc. (anything the enemy or other game object needs to function in the game). These gameobjects are nothing more than the script, no other components. The top level gameobject has a script that reads the children and instantiates game objects for the gameobject children from cache based on time - it’s a basic handler for what needs to be spawned at what time.

So - given that - for a mobile release app, would instantiate be bad in this case or should I really use loadleveladditive()? I prefer to not use loadlevel async because of the delays, as this was how the game was written in the beginning - to be seamless to the end user.

A single instantiate for the whole level “scripting” bad? It would be destroyed when a new level would need to be brought into the foreground, and thus it would destroy the root of the level and thus the gameobjects it holds (gameobject + script - nothing more / no textures, graphics, etc - nothing that needs to be pushed to the video buffer).

Alternative is to load a scene containing the same gameobject tree.

My worry with instantiate is that when levels get to greater numbers, 100+ how bad this will be on ram on the lesser devices. I have not crunced that numbers for all those Vector3’s that it may contain (plus the rest).

Thanks for opinions - and if you are reading this and decide to look this up without prior knowledge, please refrain from posting “I looked this up” replies - thanks.

So I didn’t have a game with that many levels yet. But instead of loadleveladditiv you could also use loadleveladditivasync.

Are you instantiating with Ressources.Load() ?

if so, from my experience I prefer using loadleveladditiv to Resources.load as from my point of view I had the impression that loadleveladditiv was a bit faster then loading different objects from resources.

I also think that having different levels is easier to manage then one huge level, but this is only my experience.

So on the other hand it all depends on how many objects you need to load for the differentt level and also the size of the level. If the number isn’t too huge you might wanna consider object pooling and activating/desactivating objects as this is much faster.

For the number of vector3s stored I don’t think that it’s really noticeable because every vertex is a vector3 and I can run over 2 million triangles on an iPhone 4S and each triangle contains 3 vector3s so there shouldn’t be too many performance issues on that.

I hope that that made any sense what I wrote :wink: