Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to save "Angry Bird like" level progress in a unity game

Discussion in 'Scripting' started by Foose, Jul 3, 2014.

  1. Foose

    Foose

    Joined:
    Jul 3, 2014
    Posts:
    21
    Hey guys,

    I am totally new to unity and actually quite new in programming anyways. So I started to build a 2d game in angry birds style. You have different levels and a level UI that unlocks the next level after you finished the previous. So my question is, is there any easy method to keep track of the unlocked levels and keep track of the progress even after the player has closed the game and come back later? I saw a "save game" asset at the asset store but don't know if it fits my needs. Hopefully someone can help me :)

    P.S. I was thinking about creating a table with bools for each level and do a script that sets the level to "completed" in the table after you finish a level. But I really don't know how to save this table for the next playing session.


    greetz Foose
     
  2. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    958
    Hi Foose,

    there are several ways to do it, if you have a read through the answer I submitted to this question, there are a few links that should help you!

    Enjoy
     
    JeffreyG_18 and Foose like this.
  3. Foose

    Foose

    Joined:
    Jul 3, 2014
    Posts:
    21
    Ahh. Thank you very much. Yea with some research i came through the "PlayerPrefs" option too. Now I know its actually quite easy to save the game progress. I think it's just going into local storage so the last game progress state after ending the game and come back is still there, right? Now I want my game to be played on a Facebook canvas without the user having to sign into the game and create an account. So there is actually no possibility to get excess to the local storage for each user right? I looked up the "Save Game" asset and this is exactly what I am looking for but do I have to set up a server which saves the individual game progress for each player or is there a more simple way?
     
  4. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    958
    If the user is playing the game on the same computer, both persistentDataPath based approaches and PlayerPrefs should work, as far as I am aware. If you want the user to be able to maintain their progress on another machine logged into the same Facebook account, things get more complicated and I cannot really help you, as I have never looked into it.
     
    Foose likes this.
  5. Foose

    Foose

    Joined:
    Jul 3, 2014
    Posts:
    21
    Ok thank you, so the progress i stored on local machine even if the game is stored online? I will try it that way coz I am planing to make an iOS version of it too. I've seen Unity, Facebook and Parse.com work very well together with its SDKs so I guess shoudnt be much of a problem to setup a user/Facebook User database on Parse.com that connects to the actual game :) But I will go with the PlayerPrefs option first.