- Home /
The question is answered, right answer was accepted
Android PlayerPrefs example? (I´m too stupid :c)
(Maybe my English isn´t perfect)
Hey, I want to use PlayerPrefs in my Android game, and I already read some stuff ´bout it, but I still don´t understand it.
Can someone give me a simple example how to do this in PlayerPrefs:
If the user starts the app, a "Welcome screen" will appear. But it would appear everytime the user loads the main menu scene.
If the user taps on "continue", it will save in the PlayerPrefs that the user saw the welcome screen.
If the user quits the game, it will delete the "welcome screen" stuff, so it will appear again if the user starts the app next time.
I'm sorry to be negative, but if you didn't understand what you read, why would you understand and example posted here?
You should attempt the script first, post your attempt and ask a question based on that.
UA doesn't take too kindly to "Write $$anonymous$$y Script".
Answer by siddharth3322 · Jul 30, 2014 at 08:58 AM
Here I provide example to you related to storing int value in player pref. You have to manage it something like bool for your need.
public static void StoreDebutantPuzzleId(int puzzleId){
PlayerPrefs.SetInt(Constants.PLAYERPREF_DEBUTANT_PUZZLEID,puzzleId);
PlayerPrefs.Save();
}
public static int RetrieveDebutantPuzzleId(){
return PlayerPrefs.GetInt(Constants.PLAYERPREF_DEBUTANT_PUZZLEID);
}
Based on retrieve of this value you have to decide you have to show welcome screen or not. Pretty simple :)
Follow this Question
Related Questions
PlayerPrefs in android 2 Answers
PlayerPrefs file wrong stored location 0 Answers
Double icon in Android app drawer 1 Answer
How to save a bool in playerprefs as false 1 Answer
GetInt can only be called from the main thread on Android 0 Answers