hi i’m very new in Unity3d and in Javascripting,
i’m doing a game with questions and every question has propositions in buttons. so the player have to choose one answer, and when he clicked on, the buuton change it’s color and the button becomes desabled. i have no idea how to do this.
thanks for your help guys.
To enable and disable a button, you have to deactivate the gui before you draw the button and activate it again afterwards.
You could use GUI.Toggle, which has additional 4 (“on”) states, 8 in total. You can skin those additional states, and set the additional selected parameter (boolean) to switch between selected/deselected states (or in your case enabled/disabled states):
GUI.Toggle(Rect(10, 10, 100, 30), selected, “Toggle button”);