I faced this problem a couple of months ago for the first time but i decided to skip it and develop other features of my plugin. One of these features exposes, to the editor, a custom scene derived from FAdvancedPreviewScene class, it allows game designers to provide a preview of what was the result of pressing some inputs and changing values in the Slate Widgets, then a routine serializes and saves these changes into a binary file for later use, nothing special but what i’m trying to achieve now is to play a SoundCue at the position of a SkeletalMeshComponent in this scene. This SkeletalMeshComponent has an AudioComponent attached to it. The sound should be emitted by the AudioComponent at the certain location in the world making use of attenuation settings (in order to obtain the desired positional effect) set in the soundcue loaded. This problem appears to be bound only with the editor code, maybe for some obvious reasons, that i didn’t find at the moment.
I hope someone can help me. Thanks in advance.
The code looks something like this:
USoundWave * SoundWave = LoadObject<USoundWave>(
NULL, TEXT("SoundWave'/Plugin/Sounds/Full_Wave.Full_Wave'"),
NULL, LOAD_None, NULL);
//...
USoundCue* SoundCue = LoadObject<USoundCue>(
NULL, TEXT("SoundCue'/Plugin/Sounds/Full_Cue.Full_Cue'"),
NULL, LOAD_None, NULL);
AudioComponent->SetSound(SoundCue);
AudioComponent->SetWaveParameter(FName(TEXT("InWaveParam")), SoundWave);
AudioComponent->Play();