- Home /
How to check int value of PlayerPref
Hi all, I am very confused on how to check the value of a Playerpref. I have looked online at tutorials, but they only cover setting the player's position. I would like to write code that check if the value of a playerpref it equal to a number, than it does something. More specifically, when the player walks into a trigger, a cutscene will play, but when he dies and restarts, I don't what the cutscene to play.
Answer by RealFolk · Jan 26, 2021 at 02:17 AM
Here is some pseudo code that should get you on the right track.
bool cutScene1Triggered;
if(cutScene1Triggered == true && PlayerPrefs.GetInt("CutScene_1") != 1)
{
//play cutscene here
PlayerPrefs.SetInt("CutScene_1", 1);
}
Your answer
Follow this Question
Related Questions
Save player position when trigger is destroyed 1 Answer
"If there is no save data" or "If there are no PlayerPrefs" 2 Answers
PlayerPrefs and own Class 1 Answer
PlayerPrefs save after quit? 2 Answers
Making a less complicated save system. 2 Answers