我想制作一个用户界面,让玩家可以选择继续玩游戏(关闭菜单)或转到主菜单。该代码之前运行良好,但今天,我将其加载,发现由于我正在处理的脚本不同,我的所有代码都没有编译。所以,我删除了脚本组件,然后再试一次。
我遵循了此处列出的推荐建议,并且它以前有效 - 但现在它不起作用。我不知道我做错了什么。附上我拍的一些照片和代码。任何和所有的帮助将不胜感激。
/// <summary>
/// This class controls the 'Resume Game' Button. When the button is pressed, it removes the menu, and allows the game to continue.
/// </summary>
public class ResumeButton : MonoBehaviour {
public bool isPaused = false;
public GameObject menu;
public void ResumeButtonClicked()
{
Time.timeScale = 1;
menu.SetActive(isPaused);
print("It is not paused!");
isPaused = false;
}
public void MainMenuButton()//There is only one button in the scene, this was code I was planning to add in. I am keeping it in here just in case it has any effect on the answer.
{
Application.LoadLevel("TestScene2");
}
}
方法未出现: