Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Warning ABSOLUTE beginner here. Wanting to load Scenes as levels

Discussion in 'Editor & General Support' started by battlepetal, Jun 22, 2020.

  1. battlepetal


    Apr 14, 2020
    I'm a complete beginner. I literally started last week. I've had a few challenges but nothing I couldn't overcome and had a lot of fun doing so. That is until this problem. I am trying to make a simple game where players overcome obstacles in a scene and progress to the next scene. The act of moving on to the next scene = leveling up. I cannot seem to figure out how to
    - save the scene as a level
    - then load the same back on whatever "level" the player was last one.
    I've literally spent the last 6 days searching the internet for answers, watching vids, reading blogs and the Unity manual but with no luck. I always figured if I had the question someone else had it before me but maybe I am asking the wrong questions because everyone is showing how to go from one scene to the next and everyone is show how to save and load imaginary values like "health" and "power" but no one is combining the two principles together. As you can imagine its a little frustrating but also educational. I'm absorbing the information and learning a lot but I'd also like to actually move on to the next phase.

    I'm hoping someone here can help me. I need to create a script that when i click a button in game will save the Player's current "level" ie the Scene number and then when the click Load Game in the main menu, it will take them to the last saved "level" ie that scene.

    I just need either someone to point me in the direction of where I can find the information that will teach me how to do this or even the first steps of the coding. I can figure out the rest. I'd be grateful for any help I can get. Thanks in advance.

    (In case anyone is wondering what I've accomplished in the week since I started I created the entire framework of my game Its very simple of course (by using google and following tutorials) and I intended to start adding more complicated mechanics as the levels increased so its important for me to be able to get this figured out lol)
  2. Joe-Censored


    Mar 26, 2013
    If you just need to save a string or number for the current level, you can just use PlayerPrefs. Unity also supports standard C# file saving/loading.