简体   繁体   English

比赛结束后表演一次

[英]Show scene once after lunching the game

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.我只找到了一些关于PlayerPrefs 的信息,我真的不知道如何使用它。

Thank you for your time!感谢您的时间!

You can set variable in PlayerPrefs like this:您可以像这样在 PlayerPrefs 中设置变量:

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);
     }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM