- Home /
Question by
munggol97 · Nov 26, 2018 at 02:14 PM ·
scripting problemgameobjectbuttonsetactivecondition
Make a gameobject inactive and active
I have game objects which is button (Called as tiles), when the button is clicked it will be inactive and there's a condition to be tested if the condition is true the button will be destroyed but if its false the button will back to its active status.
My game Manager script (The condition):
public void checkword()
{
wordBuilded = displayer.text.ToString();
if (txtContents.Contains(wordBuilded))
{
Debug.Log(wordBuilded + " Is on the list");
wordScore++;
Debug.Log(wordScore);
}
else
{
Debug.Log("Someting is wrong..");
FindObjectOfType<LetterTiles>().tileStatus();
}
}
On my Button (Tile) script (Script attached to the buttons):
public void letterClick()
{
gameManager.currentWord += letter;
gameObject.SetActive(false);
}
public void tileStatus()
{
gameObject.SetActive(true);
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612182801im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
one button to hide and unihed gameobjects 0 Answers
Panel GameObject not activating 0 Answers
Panel GameObject not activating when called from another script 1 Answer
Setting an inputfield to inactive until a button activates it? 2 Answers
How to make a button fixed its position on a gameobject model ? 1 Answer