- Home /
Multiple Scenes for Multiple Levels, or One Scene with all Levels?
Hello. I recently began working on a simple 3D platformer (I'm new to Unity). What I have completed so far are character mechanics, enemies, health, etc., and I'm thinking of making all of my levels next.
So my game is very simplistic with simple cube graphics. I was thinking of making every level somewhat similar. For example, every level will be a long rectangular base that my character has to navigate through, but the obstacles on these rectangular bases will vary.
For the beginning of my game, my character will spawn in a little hub-world where multiple, floating colored-cubes will be in front of him. These cubes all resemble the different levels. In order to enter these levels, my character will have to come in contact with one of the cubes.
So my question is: will it be better to make all of my levels in one scene, so I just have to make the character collide with a cube, then teleport him to a level that's located somewhere else in the scene? (I'd also like to know if having many levels in one scene could lag the game) Or should I just make every level in different scenes?
I'm really worried about this because when I think about making multiple scenes for multiple levels, I don't think I will be able to call on other variables and GameObjects from different scenes. (For example: My character completes Level1. What happens is he is teleported back to the hub-world and the Level1 cube that teleported him to the level in the first place is destroyed, so he can't play through that level again.) I feel like that would be easy to do if all of my levels were in the same scene. All I would have to do is make an if statement like:
if (Coll.GameObject.tag == "levelEnd") {
player.position(); //Not sure if this is the proper way to teleport my character
Destroy(level1Cube);
}
I don't think I'd be able to do "Destroy(level1Cube);" if the level1Cube is in a different scene.
In conclusion, all I want to know is what's the better choice for my game: multiple scenes for the levels, or one scene with all levels?
Answer by shadowpuppet · Sep 09, 2017 at 02:33 AM
I'm sure a better answer will come from some one else. I prefer to make separate scenes but primarily because I have pretty busy scenes so to try to do it all in one will be pretty taxing. It also is nice to complete a scene then move on to the next. like in your scenario, I would finish that level (scene1)and make a copy of that scene and call it scene 2 and make whatever changes I want to that scene to make it different - delete the enemies, add geometry, remove geometry - whatever. In scene 1, if the cube the player collides with to go to the next level is scene2, then in scene 2 place the player where he needs to be and that is where you will be for scene 2 and in this scene delete the level1 cube. So whatever cube "teleports" you to another level, in that new level do not have that cube there. so each copied scene has all the scripts and enemies and player you just remove or add to make it different
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Dice Value 1 Answer
When I move and then rotate my direction doesn't change. 0 Answers
Removing instantiated objects?? 1 Answer