- Home /
SFX seem slow
So I have a button on click playing a sound effect. I've gone into the sound effect and edited it manually, so there's absolutely no dead air at the beginning of the sound. The sound is literally 0.16 of a second. It's a deep button press type sound, just to give my buttons more of a "buttonly" feel when being pushed. Again, I've edited out the dead air on the sound, so it should start immediately upon being pressed.
When I push the button, there's a slight delay. It's not a lot, but it's enough to make it feel like a delay when pushing the button. It's not a satisfying click of a button, if you know what I mean. I've played games from Unity where button pushes feel good, so I'm just wondering if there's a trick to making the sound effect play faster, because clearly there is something causing a delay here.
Thanks for any help you can provide! Let me know if there's more info I can give.
Answer by Bunny83 · Jul 31, 2019 at 08:23 AM
There are essentially two factors:
If you use an ordinary button click event it will fire when a click happens. A click is a mouse down and mouse up event. So the code runs when the user releases the mouse / touch. You want to use the "IPointerDownHandler". Unfortunately Unity seems to have removed all the UI stuff from their documentation.
The second issue can be an actual delay in your sound file. If that's the case you have to edit your sound effect and trim the silent part at the beginning.
Answer by Cosmology27 · Aug 02, 2019 at 02:38 AM
Is there any way to have the IPointerDownHandler happen in the inspector? Or do I have to write all my own mouse clicks manually now?
EDIT: I'm trying to get the mouse down to work, but I can't figure out how to get IPointerDownHandler working. Online it seems a lot of people have strange issues with it. I'm trying to put it on a button, and can't seem to find a solution.
I've tried using "public void OnMouseDown()", and I'm getting zero errors, but it's not recognizing the mouse down. It looks to me like it should work (all I'm doing is trying to get a debug message to see if it works, it's super simple). I'm guessing the onmousedown isn't meant for buttons, and I can't figure out the IPointerDownHandler. How should I do it? Thanks for the help!
Still looking for an answer to this. That IPointerDownHandler isn't doing anything, but it's also not giving me an error. Still can't manage to get a mouse down to work on a button. Thanks for any help anyone can provide.
Your answer
Follow this Question
Related Questions
UI Button deletes Function on start 1 Answer
Sound play on key combinations? 1 Answer
How to play a sound effect 1 Answer
Button OnClick() after Scene restart is Missing (Object) 2 Answers
Separate setting music volume and sfx in one scene 0 Answers