Godot Universal UI Sound Player
A downloadable Addon
This is an addon for Godot 3.5.1+ which lets you easily set up UI Sound Effects for your buttons, menus etc. and change out the sounds any time - even programatically, but defining SoundPacks - a new Resource this plugin/addon defines.
Usage
1. Install the addon and enable it via Project > Project Settings > Plugins > UI Sound Player
2. Create a new UISoundPack resource and add your sound effects (these maybe?)
3. Open Project > Project Settings and under General, scroll down till you see the "UI Sound Player" entry. Put the path to a UISoundPack resource - this will be the default sound pack. Alternatively, call UISoundPlayer.soundPack = yourSoundPack to set it programatically. UISoundPlayer is an autoload that is registered by the plugin.
4. For any node that you wish to play sounds, add them to a special group with the following pattern: uisound_[event_name]=[sound_name],.
For example, if you have a button and you want it to play 'focus' when it is focused, add it to the group 'uisound_focus_entered=focus'.
If you want to play a sound when a number value is increased or decrease - you need to emit those events. For a SpinBox, like in the video preview, you can add the following code to it, as a new script:
extends SpinBox signal value_increased() signal value_decreased() var old_value func _ready(): old_value = value connect('value_changed', self, '_on_value_changed') func _on_value_changed(new_value): if new_value > old_value: emit_signal('value_increased') elif new_value < old_value: emit_signal('value_decrease')
Of course, instead of emitting thse new signals, you could just call UISoundPlayer.play_effect('nav_up') when new_value > old_value and .play_effect('nav_down') if new_value < old_value.
After adding the above script, you can add these two groups to the SpinBox node: uisound_value_increased=nav_up and uisound_value_decreased=nav_down
Status | Released |
Category | Assets |
Author | Pelatho |
Tags | addon, Godot, Graphical User Interface (GUI), plugin, Sound effects, User Interface (UI) |
Download
Click download now to get access to the following files:
Leave a comment
Log in with itch.io to leave a comment.