How to simply play a sound?

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 :slight_smile:

105638-tmp1.png

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=)