Button Not Working

I had no idea what thread to put this in, but I have a game in development right now and I have a level complete scene that is hidden in the scene at first but becomes seen once the player reaches a certain point. On that panel I have 2 buttons, 1 for main menu and 1 for the next level. Whenever I play my game however, the button don’t work at all. Is this because buttons don’t work in the scene if hidden at first? Here is my code and a screenshot of my scene. Thanks.

public void NextLevel()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
level = level + 1;
}

public void MainMenu()
{
SceneManager.LoadScene(0);
level = 0;
}

Is the LevelComplete script attached to the “LevelComplete” object that’s inactive? That might be the problem. Try removing the script from there and placing it on your Canvas object and see if that works.

I know that Unity is finicky about calling scripts from inactive objects.