Hello! I'm making a game and I want to add a tutorial(walkthrough) at the beginning of the game. So, I created a scene where I have all the information and now I just want to show it once after the game was launched and never show it again.
I have already search on the internet for the information. I only found some info about PlayerPrefs and I don't really know how to use it.
Thank you for your time!
You can set variable in PlayerPrefs like this:
PlayerPrefs.SetInt("IsFirstRun", 1);
and then you can check if the variable exists:
if(PleyerPrefs.HasKey("IsFirstRun")) // show the scene
This is how your script would look:
void Start()
{
if(!PleyerPrefs.HasKey("IsFirstRun"))
{
// open scene
PlayerPrefs.SetInt("IsFirstRun", 1);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.