プレーヤーがゲームを続行する (メニューを閉じる) か、メイン メニューに移動するかを選択できる UI を作成したいと考えています。コードは以前は正常に機能していましたが、今日、コードをロードしたところ、作業中の別のスクリプトが原因ですべてのコードがコンパイルされていないことがわかりました。そのため、スクリプト コンポーネントを削除して、もう一度やり直しました。
ここにリストされている推奨アドバイスに従いましたが、以前は機能していましたが、現在は機能していません。何を間違えたのかわかりません。私が撮った写真とコードを添付します。ありとあらゆる助けをいただければ幸いです。
/// <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");
}
}
メソッドが表示されない: