Can I have one scene for my whole game using enable and disable 30+ level 2D pixel tile maps? Will this have a impact of the game being slow?
Think of a Scene is just another container like an Empty game object, and you can load it when it’s needed like a Prefab.
Your approach is going to be a memory hit, not a speed hit. If each level is really not much data, enabling and disabling them may work, but it seems to me that the better design would store all that level data into a format you can load and destroy, such as prefabs or scriptable objects or scenes loaded additively.
Go with a Scene per Level. However for my menus I use just one Scene and DoozyUI views to swap them in/out.
You can do everything in 1 scene but I wouldn’t recommend. It is relatively easy to make a setup with lots of specific scenes by using the dont destroy on load method: Unity - Scripting API: Object.DontDestroyOnLoad
Put this on your player and everything you want to travel to the other scenes.
I thought i read an article about this kind of thing, where the game only loaded objects/assets that were a few degrees past the field of view. But i do remember it was for a 3D game. Shouldn’t it work for 2D also?
So here’s the article that shows what i meant.
I will have a lot of scenes if I do that. If I want to change something in my level scene like 30+ levels, I will have to go each one by one and change.
You can also store each level in a GameObject and only enable the active one
If you have stuff which is identical in each scene, then put that stuff in a shared scene or prefab.
If you need to change something unique in 30 scenes, that’s just the nature of development… you will either have to open and find that stuff in 30 places in the same hierarchy (annoying) or you will have to open and find that stuff in 30 scenes (annoying).
Hello Everyone, I know this trend is old. But looking at a game like Orbia for mobile with over 1000 levels. while playing it, it all looks like it’s being played on only one scene. or is there a way to disable processes or movements while the game object is off camera?
Yes and rendering is automatically disabled off camera. Mechanics and physics-related objects have to be disabled and enabled “manually” though. Note that “disabled” does not mean the memory is freed! Therefore you’d have to fully destroy and create dynamically, meaning you need a custom way of storing the level design (which for a game like Orbia is surely not too hard). If you do go such a route, read up on “object pools” as those will improve performance.
However for a classic platformer etc. simply using separate scenes is the way less head aching way of designing a game and it’s possible to load scenes asynchronously, so the actual transition from one scene to another will not require a loading screen.
Let’s not continue necroing/hijacking this super old thread that isn’t even related to 2D at all.
Please create your own thread in the Scripting forum.
I’ve also moved this thread to the Scripting forum where it belongs.
Thanks.