- Home /
Question by
AusAndrew19 · Mar 13, 2013 at 08:39 AM ·
guiaudiosound
GUI.Button Hover = Sound
I just implemented a Main Menu.. I was wondering if there is a way to Play a sound when the mouse hovers over a button? I have searched through the forums etc but haven't found a definitive answer so hopefully someone could point me in the right direction.
Comment
Best Answer
Answer by Professor Snake · Mar 13, 2013 at 08:59 AM
You can use if(buttonRect.Contains(Input.mousePosition))
to check whether the mouse position is inside buttonRect, assuming buttonRect is the Rect your button uses.
Your answer
![](https://koobas.hobune.stream/wayback/20220613094322im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Sound playing at random. (JS) 2 Answers
Play sound on button click before loading level. 3 Answers
Help With GUI Stop and play other Sound ? 1 Answer
Play Sound when GUI button is pressed. 7 Answers
play audio clip 1 Answer