I seached around and found only strange solutions; Whats the simplest way to play a Sound with c++?
I already found the function UGameplayStatics::PlaySound
UGameplayStatics::PlaySound2D (it changed name i think) is the simplest. I guess you got might have issue with getting USoundBase object?
Simplest way to get it is to simply make a editor editable USoundBase* varable (with EditAnywhere) in class make a blueprint out of it and set sound asset to that varbale in editor so you donโt need any messy referencing code
Thanks for your fast answer, thats a good idea and works great, but actually Iโm spawining my actor dynamically. Any idea on how do it this way?
I finally found it myself. It can be instanciated like this:
static ConstructorHelpers::FObjectFinder<USoundBase> Soundf(TEXT("/Game/Sounds/backgroundsound"));
class USoundBase* Sound = Soundf.Object ;
Thanks, it works for me=)