У меня следующая проблема: кнопка «Возобновить» не работает. Я могу приостановить и возобновить игру, нажав ESC, но когда я пытаюсь нажать кнопку возобновления, ничего не происходит. У меня есть система событий, и цель raycast находится в окне возобновления
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Pause : MonoBehaviour
{
public GameObject menu;
public GameObject resume;
public GameObject quit;
public bool isPaused;
// Start is called before the first frame update
void Start()
{
menu.SetActive(false);
}
// Update is called once per frame
void Update()
{
if ( Input.GetKeyDown(KeyCode.Escape))
{
if (isPaused)
{
Resume();
}
else
{
PauseTheGame();
}
}
}
public void Resume()
{
Time.timeScale = 1f;
menu.SetActive(false);
isPaused = false;
Debug.Log("Perfect");
}
public void PauseTheGame()
{
Time.timeScale = 0f;
menu.SetActive(true);
isPaused = true;
}
public void Exit()
{
Application.Quit();
}
}
У меня следующая проблема: кнопка «Возобновить» не работает. Я могу приостановить и возобновить игру, нажав ESC, но когда я пытаюсь нажать кнопку возобновления, ничего не происходит. У меня есть система событий, и цель raycast находится в окне возобновления [code]using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Pause : MonoBehaviour { public GameObject menu; public GameObject resume; public GameObject quit;
public bool isPaused;
// Start is called before the first frame update void Start() { menu.SetActive(false); }
// Update is called once per frame void Update() { if ( Input.GetKeyDown(KeyCode.Escape)) { if (isPaused) { Resume(); } else { PauseTheGame(); } }
public void PauseTheGame() { Time.timeScale = 0f; menu.SetActive(true); isPaused = true; } public void Exit() { Application.Quit(); } } [/code] Я пытался изменить код, но ничего не помогло.