[英]Should I use SceneManager.LoadScene(“Scene Name”) for infinity game?
[英]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.