Forum Discussion
Dae_K
1 year agoExplorer
How to make grab interactable to make a sound
How do I trigger a sound when I grab something?
Things I have tried:
* Interactable Unity Event Wrapper to be triggered when Grab Interactable gets selected.
I would have a gameObject not related directly to it with script "SoundHandler", with a public function "PlayGrabbedSound()" and then bring that game object in the Select of your event wrapper and select the script, then the function.
The soundHandler script would have the audiosource component and the reference to the sound clip that will be played in the function.
If you whant to do that at runtime, you might want to have the soundHandler subrscribing to the grabEvent or something in those lines...
Hope that helps, I'm quite new to this and I'm sure there are better way to do it, but that would work.
1 Reply
- MikyjaxProtege
I would have a gameObject not related directly to it with script "SoundHandler", with a public function "PlayGrabbedSound()" and then bring that game object in the Select of your event wrapper and select the script, then the function.
The soundHandler script would have the audiosource component and the reference to the sound clip that will be played in the function.
If you whant to do that at runtime, you might want to have the soundHandler subrscribing to the grabEvent or something in those lines...
Hope that helps, I'm quite new to this and I'm sure there are better way to do it, but that would work.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 2 years ago
- 2 months ago