A Component that lets you play a sound or some music.
The Play Sound Component lets you play a sound effect or music from a Library of audio files.
Clicking the field opens a pop up with a selection of sounds you can choose from.
At the moment you aren’t able to upload custom sounds.
This variables maximum range is defined by the Magic Gem.
By default, it has a range between 0- 4
Play On Start Play - Play on Start will make trigger the Component to play the selected sound when the experience starts.
Play On Receive Message - This option lets you define a message the Component will 'listen for' that will trigger the sound to play.
Play on Players Interact - Will trigger when a player presses 'E' on the object with the component added to it.
Setting a sound to 'Loop' by choosing 'True' means that the sound will keep playing once triggered. If you leave the loop toggled to 'False', then the sound or piece of music will only play once the whole way through.
2D Sound will play the chosen sound at the same volume regardless of distance or the orientation of the player.
3D Sound will change volume based on the distance the Avatar is to the Object with the Play Sound Component.
The sound will also be audible based on the location of the player. This means that if a player is standing to the right of the object emitting the sound, they'll hear the sound louder in the left headphone or speaker as though the sound is coming from that direction.
If set to 'True' the Sound Component will display two more drop-down options.
Message to Stop - Will turn the track completely off. This means if the sound is started again it will play from the beginning.
Message to Pause - Will stop the sound wherever it has gotten up to, and if the sound is triggered to play again, it will start from where its playthrough was interrupted.
You could use a Speaker component to identify when an Avatar is close by, which could send a message to play a sound or some music that indicates a battle has started, or a clue may be nearby!
Use the Door Behaviour as a switch.
In this example, we have a radio with the Door Behaviour applied.
The 'Message to Open' is set to 'Radio.On.'
The 'Message to Close' is set to 'Radio.Off.'
The Play Sound Component is added to an Object above the radio and switched to invisible.
The 'Play On Receive Message' is then set to 'Radio.On'
The Interuptable 'Message to Pause' is set to 'Radio.Off'.
With this set up the sound isn't actually coming from the radio, but it does now control the messages that trigger the Play Sound Component.