Hey all -
I'm wanting to have my game be a little more accessible from an audio standpoint for gamers without sight and would love to have a method of playing a 3d sound on a hotspot when it becomes highlighted. Having a one shot sound would be great, but having the ability to have a sound start/fade in, loop as it's highlighting, and then stop/fade out when it stops being highlighted would be ideal.
My preference would be to have a default 3D sound set for the game globally so I don't have to attach a sound to every single hotspot in all of my scenes.
Anyone know if/how this would be possible?
Comments
(More on custom events can be found in the "Custom events" chapter of the Manual, as well as this tutorial)
You could rely on an entirely custom script, but here's a way that should work with Actions and a minimal reliance on scripting.
Create a new Sound object, assign the AudioClip and attach this script:
http://pasteall.org/832381/csharp
This script will have it automatically trigger ActionList assets whenever a Hotspot is selected/deselected.
Also attach a Constant ID component, check Retain in prefab? and make it a prefab.
Then create two ActionList asset files that each have a Sound: Play Action to affect this Sound - one to fade it in, one to fade it out. Assign them in the script's Inspector, update the prefab, and add to each scene in your game (best test with just one first though)