I have a disable button code in which it disables other buttons on the press of a numbered int button. How would I can I make it find and disable buttons by tags rather than just dropping and dragging each button a dozen times? Here is my code so far:
public class test : MonoBehaviour
{
public Button b1;
public Button b2;
public Button b3;
public void switchbut(int x)
{
deactivateall();
if (x == 1)
{
((I WANT A FIND AND DISABLE TAG FUNCTION HERE))
b1.interactable = false;
}
else if (x == 2)
{
((I WANT A FIND AND DISABLE TAG FUNCTION HERE))
b2.interactable = false;
}
else
{
((I WANT A FIND AND DISABLE TAG FUNCTION HERE))
b3.interactable = true;
}
}
public void deactivateall()
{
b1.interactable = true;
b2.interactable = true;
b3.interactable = true;
}