[英]Cannot Load Scene in unity3d
I want to reload the scene when clicking on a button, but its telling me beside the scene name (not loaded) and here is my code: 我想在点击一个按钮时重新加载场景,但它告诉我旁边的场景名称(未加载),这是我的代码:
public void winClick()
{
WinGUI.SetActive(false);
NextLevel.gameObject.SetActive(false);
GameStateManager.GameState = GameState.Playing;
SceneManager.LoadScene("mainGame");
}
Open "File > Build Settings" and ensure the mainGame scene is present in the scene list. 打开“文件>构建设置”并确保场景列表中存在mainGame场景。
As a side note, you can avoid manually passing the scene name when you want to reload a scene with the following: 作为旁注,当您要使用以下内容重新加载场景时,可以避免手动传递场景名称:
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.