- Home /
"Variable Not Assigned" error but it is assigned
I have a pause menu screen in my game, and I have made it so that when you click the "Main Menu" button, it pops up with a panel saying "Progress will be lost. Are you sure" and two buttons - one to cancel and one to continue to the main menu. All the script does is when the "main menu" button on the pause screen is clicked, the progressLostPanel GameObject is SetActive(true) and then when you click "cancel", it's progressLostPanel.SetActive(false). Theoretically, that should just close the panel, right? Apparently not. It pops up fine so the object is assigned and works, however when I press "cancel", I get an error saying that the game object progressLostPanel has not been assigned. I'm super confused because it is assigned and even works except for the cancel button (the "back to main menu" button even works properly as well). Below are my functions and some screen shots.
public void ShowProgressLostPanel()
{
progressLostPanel.SetActive(true);
Debug.Log("Progress Panel Showing!");
}
public void HideProgressLostPanel()
{
progressLostPanel.SetActive(false);
Debug.Log("Progress Panel Hidden!");
}
Answer by PilgrimFlowers · Jan 01, 2021 at 11:22 PM
Oh my gosh... I think I just fixed it. For some reason, all I had to do was apply the changes to the prefab and it works now... What a weird bug.
I get it, first phase is denial. but errors are correct. I have yet to find an error the computer was wrong about.
Your answer

Follow this Question
Related Questions
In game right click menu 1 Answer
How to Change Menu Button Rollover States with GameObjects 1 Answer
UI Questions 1 Answer
Switching between inactive scenes 1 Answer
Menu button in game isn't working 0 Answers