how to disable ui button once clicked?

i am creating a hangman like game. i want to disable a button once it was already clicked. i am new in unity so please help me. thanks

Hi @creamywhite

if you only need to make it non-interactable, you could directly do with the button itself; no need to write a code for that.

In the button , you have onClick option. Add one option there.

Drag and drop the button into the space provided

Select the option- button> bool interactable

After that uncheck the “tick-mark” option.

Your button will become non-interactable when you click the button

Happy coding

Hey,

You need to create a public method having code for making button non interactable . And assign that method to OnClick event of Button.

i tried the code in the “interactable” link, but what happens is once i enter play mode, the button is already not interactable although i did not clicked it yet. i want it to be not interactable once i clicked the button. how?