I’ve made a pause menu with two buttons, one to resume the game, and the other one to exit the game. The Canvas has an event manager, and both buttons have both interactable and raycast target boxes checked. So why won’t the buttons change color when I hover over them or click them? Before you ask, yes I did set up different colors for every mouse input. Also, I put a console log for the “quit to main menu button” to see if it works, but the console isn’t displaying anything to me. Any idea how to fix this? I’ve been losing my mind for the past 5 hours trying to figure this out.
Here’s the code (not mine, found it on youtube because I can’t code for s@@t):
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PauseGame : MonoBehaviour
{
public static bool PausedGame = false;
public GameObject PauseMenuUI;
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (PausedGame)
{
Resume();
}
else
{
Pause();
}
}
}
public void Resume ()
{
PauseMenuUI.SetActive(false);
Time.timeScale = 1f;
PausedGame = false;
}
void Pause()
{
PauseMenuUI.SetActive(true);
Time.timeScale = 0f;
PausedGame = true;
}
public void QuitGame()
{
Debug.Log("ExitingGame");
}
}
Very important: I’m no tech veteran, nor a game designer, so please, if you have the solution, try to keep the technical jargon to a minimum and explain it to me like I’m 10. I’m just a guy working on an exam project due in 3 days and I want to be done with it already. The game’s almost finished, but I just can’t get over this issue. Please help.