My Unity game has a large planet GameObject that serves as the map. I want to keep this planet loaded, but still create different levels where enemies and the player are spawned at different locations on the planet, depending on the level. Therefore, the objectives, targets, and vehicle the player must use and accomplish are different at each level, but the map itself is not.

I have had a couple of thoughts. My first idea is to use transforms as locations for where vehicles spawn, and assign a vehicle to each location. Perhaps then each set of locations can be saved as a prefab that represents a level.

One possible solution is to use different scenes for every level, with the main scene containing the planet being kept throughout. I am not sure how the different components can communicate with each other, however.

My difficulty with all this is how to conceptualize how all the elements will work together. Say I make a class called Level, which includes the Objective that must be accomplished to win, the Vehicle the player will use, and the Locations where objects are to spawn, etc. Then I create scripts called Level1, Level2, etc. that inherit from Level and allow custom scripting for each level. However, there is also a state where the menu shows the scene, but no objective is being accomplished. Is that a viable solution? Is there a better solution from experience?

  • \$\begingroup\$ How big is your planet? Single precision floating point is likely not precise enough to measure your gameplay scales across a space as large as the Earth... \$\endgroup\$
    – DMGregory
    Dec 17, 2019 at 19:02
  • \$\begingroup\$ @DMGregory It's small enough to avoid that problem. I've gone around the map plenty in airplanes and ships, and bullets work fine. The game itself is advanced enough that it works. However, I need to compartmentalize it in different levels at this point. \$\endgroup\$ Dec 17, 2019 at 19:36


You must log in to answer this question.

Browse other questions tagged .