Hello all
I want a code to save a int variable( as score) and load it at first replaying the game on Android.
I know how to save it on PC but not Android.
Please help me.
Thanks.
Hello all
I want a code to save a int variable( as score) and load it at first replaying the game on Android.
I know how to save it on PC but not Android.
Please help me.
Thanks.
To save it:
PlayerPrefs.SetInt(“Score”, score);
Put this in start function to load it
highScore = PlayerPrefs.GetInt(“Score”);
Don’t forget to use PlayerPrefs.Save()****; at some point within the scene to save changes- just do it at certain times (like right before loading a new scene) as it may cause a tiny bit of noticeable lag when used during normal run time
Thanks a lot.
Can you explain about PlayerPrefs.HasKey, too ??
Thanks it works perfectly.
I didn’t think it’s so easy.