U
U
Uncle Bogdan2021-06-24 14:38:14
Unity
Uncle Bogdan, 2021-06-24 14:38:14

How to get the gameobject of the button the function was launched with?

Tipo pressing the button the function from the code is caused. How to get this button in code? This method can be called on multiple buttons.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GFX Data, 2021-06-25
@ShockWave2048

Something like this:
(only it's better to check by tag or name)

var btn = EventSystem.current.currentSelectedGameObject;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question