0

I made a simple Minecraft like game and I'd like to create a new scene and copy the contents of my current(dafault) scene in order to "save" the game. I'm trying to avoid more complicated solutions so I'm asking for the simplest and fastest known solution. Thanks.

NewToPi
  • 187
  • 2
  • 9

2 Answers2

1

Do you want to do this while the game is running or just make an entirely new scene with the contents you have right now, so that you can work on a duplicated version of that scene?

If you want to do the latter, go into file explorer > Unity Game > Assets > and copy the UnityScene.scene back into your assets folder- creating a dupe scene.

If you want to do this in runtime, you can do DontDestroyOnLoad and that prevents your scene from destroying its object- therefore preserving its contents while you play the next level.

1

The shortest answer for the question is: There is no easy way to save and load a game state.

To do in the quick way, the best idea is to buy a Asset that fulfill all your needs.
Asset Store Example

The DO IT BY HAND way is:

  1. You have to store all data regarding your game into a file.
    • For example player: Player Position, Inventory, Skills, Monsters Killed, Statistics, etc.
  2. Store all world data as well.
    • In your case, position for every block and what type it is.
  3. Keep repeating steps bellow until you have all information that you need to create the new scene.
  4. Create a script that loads information from saved files into your current world.

If you want to learn more about it:

Unity 3D Official Course - Saving and Loading Data

Raphael Frei
  • 361
  • 1
  • 10