Answer the question
In order to leave comments, you need to log in
How to catch a click on any button in Unity?
How to catch clicking on any button on the canvas?
It is necessary to hang the same sound on pressing any button, but buttons can be removed / added to the canvas in large numbers. Can I somehow catch pressing any button and hang up a sound call there?
Answer the question
In order to leave comments, you need to log in
Made through eventSystem.RaycastAll, I get objects, if there is a button component, then sound occurs. Failed to deal with eventSystem.currentSelectedGameObject.
Check in which thread the eventSystem.currentSelectedGameObject is updated. If it has changed and meets the requirements (for example, it has a button. Or you can compare by tags or something else), then play the sound.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question