【问题标题】:How to avoid demo scene the second time you run an app in Unity [duplicate]如何在 Unity 中第二次运行应用程序时避免演示场景 [重复]
【发布时间】:2017-02-25 20:37:21
【问题描述】:

我们正在 Unity 中制作应用程序游戏,其中包含在您首次打开应用程序时运行的演示场景。 我想知道如何在您第二次运行应用程序时直接进入游戏主场景,从而避免演示场景。

谢谢

【问题讨论】:

  • 您是只向登录用户或所有人展示演示场景吗?
  • 仅供登录用户使用,谢谢

标签: unity3d demo


【解决方案1】:

您可以使用PlayerPref 记住用户已经访问过。在演示场景的 Awake() 中是这样的:

private void Awake(){
  if(PlayerPref.hasKey("returningUser")){
    SceneManager.LoadScene("MainScene");
    return;
  }

  PlayerPref.setInt("returningUser", 1);
  PlayerPref.Save();
}

【讨论】:

    猜你喜欢
    • 2016-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-13
    • 1970-01-01
    相关资源
    最近更新 更多