簡體   English   中英

我在Application.loadedLevelName上收到一條警告消息以使用SceneManager,但SceneManager不存在。 我該如何解決?

[英]I'm getting a warning message on Application.loadedLevelName to use SceneManager but SceneManager is not exist. How can i fix it?

這是代碼:

void Restart()
  {
    guiTools.ClearCache();
    Application.LoadLevel(Application.loadedLevelName);
  }

警告信息:

Scripts \\ Main.cs(27,27):警告CS0618:“ UnityEngine.Application.loadedLevelName”已過時:“使用SceneManager確定已加載哪些場景”(CS0618)(Assembly-CSharp)

試試UnityEngine.SceneManagement.SceneManager.LoadScene();

或在腳本開頭添加以下行:

using UnityEngine.SceneManagement;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM