How do I initialize a UAudioComponent in C++?

I’ve tried something like this:

	// Initialize audio component
	static ConstructorHelpers::FObjectFinder<USoundCue> movementSound(SC_MEG_MOVEMENT);
	movementAudioComp = CreateDefaultSubobject<UAudioComponent>(TEXT("MovementAudioComponent"));
	movementAudioComp->AttachParent = RootComponent;
	movementAudioComp->SetRelativeLocation(FVector(0.0f, 0.0f, -60.0f));
	if (movementSound.Object->IsValidLowLevelFast())
	{
		movementAudioComp->SetSound(movementSound.Object);
	}

But the audio component is inaccessible / invalid in a blueprint class that inherits from this class. Am I initializing an audio component incorrectly?

What does your declaration look like for the movementAudioComp property? Specifically, what did you put for the UPROPERTY() settings?

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category… )

It was working with the above code actually, if I created a new blueprint that subclassed from that C++ class. I think it’s something weird with C++ / blueprint classes syncing up.

I’ve had issues with certain things showing up if I don’t create a blueprint as a subclass but instead change it to inherit from the class after creation. Definitely could be the source of your problems.