I would like to access a SoundCue in one of my actor classes. I have an Actor class which contains a UAudioComponent member. The AudioComponent member is assigned a SoundCue class using AudioComponent::SetSound(). I set which SoundCue to use from the UE4 editor. THe AudioComponent member is then exposed through a blueprint method. I call Play() on it from my Blueprint. Only problem is I get no sound. Maybe it’s my BluePrint? Or is this doomed to fail from the onset?!
My Actor header contains the following:
UPROPERTY(EditAnywhere, Category = "Sound")
USoundCue* SoundCue;
UPROPERTY()
UAudioComponent* audioComponent;
UFUNCTION(BlueprintCallable, Category = "Sound")
UAudioComponent* getAudioComponent()
{
audioComponent->Sound = SoundCue;
return audioComponent;
}
I’ve checked the validity of the AudioComponent, and the SoundCue, and they are both valid. Any ideas?