Home > OS >  Button Function Unavaiable in Unity
Button Function Unavaiable in Unity

Time:07-08

I made some edit to Snake&Ladder game where a question pop-up when player reach head of snake or bottom of the ladder. I manage to get the pop-up question appear but I can't find the function, not even the able to search the function.

Visual Studio snapshot showing that the button function is unavailable

I put the button code under transform position code when the player move after reach head of snake or bottom of the ladder.

Am I not allowed to separate button code from other button code in Unity?

CodePudding user response:

There is no runtime object. That's why I'm unable to put in any function. I need to put in runtime object which contain the function I need.

CodePudding user response:

How to make a button invalid or hide when the program runs to a certain step.

method 1:

Command1.Enabled = False button command is disabled.

Command1.Visible = False button command hidden.

Method 2:

//disable

this.GetComponent().enabled= false;

//disable and gray

this.GetComponent().interactable = false;

Hope it helps you.

  • Related