Hello!
I’m trying to play a sound from audio_player_device.
I have : (translating fields from french to english, may differ but essentially it is the same)
- created the audio_player_device
- set the sound asset to play
- set “Heard by” to “Everyone”
- set “Sound location” to “Local player”
In my code, I have class named countdown_timer.
Inside this class, I have a member reference to the audio player device which I manually input from Unreal Editor:
@editable
var VfoxSoundOne : audio_player_device = audio_player_device{}
Now I have a method PlaySound :
PlaySound() : void =
VfoxSoundOne.Play()
Then a RunCountdown method which gets called from a countdown_timer_device, in its OnBegin override.
RunCountdown()<suspends> : void =
loop:
PlaySound()
Sleep(TimerTickPeriod)
set RemainingTime -= TimerTickPeriod
UpdateUI()
# Timer End
if (RemainingTime <= 0.0):
if (PlayerUI := MaybePlayerUI?):
PlayerUI.RemoveWidget(Canvas)
break
Basically, I have followed this tutorial but I want to add countdown sound.
After all this, sound is not being played.
Any idea why?
Thank you in advance!