- Home /
how to use playerprefs to make the second playthrough diffrent ?
so if you played undertale or when the darkness comes you would know what i mean but for people who havent played these games it basically when you play for the first time everything is ok and it seems like a new game but in the second playthrough the people in the game know me and have met me before and in the " when the darkness comes" the game knows my name so how do i do stuff like that?
You should code your ai behaviour depending on cases. When you start your game create a preference in playerprefs and when you complete first gameplay set it's value again like:
//When you start first gameplay
PlayerPrefs.SetInt("$$anonymous$$nown", 0); //0 means no one knows you
//When you complete first gameplay
PlayerPrefs.SetInt("$$anonymous$$nown", 1); //1 means people knows you
And during gameplay check this pref:
if(PlayerPrefs.GetInt("$$anonymous$$nown") == 1){
//Act like ppl knows about you
} else {
//Act like opposite
}
Thanks for your help, i will try now to make a game before i add any of these. But really thanks for your help!
Answer by MoR81204 · Apr 09, 2019 at 01:51 PM
@Sneakypizza5776 You could save these as bool values eg. bool firstTimePlaying and if it's false on load then do your stuff.