我想在单击按钮时重新加载场景,但它在场景名称旁边告诉我(未加载),这是我的代码:
public void winClick()
{
WinGUI.SetActive(false);
NextLevel.gameObject.SetActive(false);
GameStateManager.GameState = GameState.Playing;
SceneManager.LoadScene("mainGame");
}
最佳答案
打开“文件 > build设置”并确保主游戏场景存在于场景列表中。
作为旁注,当您想要使用以下内容重新加载场景时,您可以避免手动传递场景名称:
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
关于c# - 无法在 unity3d 中加载场景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52797260/