[Solved] Noobish Does Not Exist in the current context

[ad_1]

Your creation of the button is scoped within startnewgame() and is not accessible to method GamePanelHideButtonClick

Move the GamePanelHideButton variable outside of both methods.

Try this

public Button GamePanelHideButton;

public void StartNewGame()
{
    GamePanelHideButton = new Button();
}

public void GamePanelHideButtonClick()
{
    GamePanelHideButton.Visible = !GamePanelHideButton.visible;
}

3

[ad_2]

solved Noobish Does Not Exist in the current context