Reputation: 11
I'd like to add a C# script to my UI Canvas with OnSelect function, but I would like to select which buttons should be affected if I select them. So if I have like 5 buttons under Canvas and I only want to make 2 of them selectable how should I go about it? Any tips?
Upvotes: 0
Views: 1071
Reputation: 12287
Sure, it's very easy.
you're looking for the "interactable" toggle.
Try "Play" your app in the Editor. When the buttons are visible, try toggling that in the Inspector!
.
yourButton.interactable = false;
or "true". It sounds like you would have five simple Inspector variables for each of your buttons.
public Button b1;
public Button b2;
and so on.
So just b1.interactable = false;
and so on.
Upvotes: 2