U
U
Uncle Bogdan2021-06-23 10:33:54
Unity
Uncle Bogdan, 2021-06-23 10:33:54

How to disable a button if it has the desired script, but the button itself should not be displayed?

Tipo I don’t want to see the button and shouldn’t work at all, but the button itself has the right script. (I can’t attach a script to canvas, because the class is attached there). I wanted to disable the components, but it seems to me that this is a stupid way. Disable 2 or 3 components and also the text on the button.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mixer1111, 2021-06-23
@Mixer1111

In fact, you shouldn’t throw any scripts on the button, it’s better to make a separate empty object for this (such an object is called GameController), write all the functions for buttons in it, and then add a function from this object to the button. And then you can safely turn off the button

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question