Override AudioComponent OnAudioFinished func

I want to override the OnAudioFinished function so that I can either loop or switch songs when a track is finished. I have a child class of AudioComponent and I am trying to add the function definition into my .h file

In the AudioComponent.h file the definition for this function doesn’t have parenthesis which seems to me like it’s not a function.

/** called when we finish playing audio, either because it played to completion or because a Stop() call turned it off early */
	UPROPERTY(BlueprintAssignable)
	FOnAudioFinished OnAudioFinished;

This makes me wonder how I would ever override this function to do what I want whenever an audio track is finished. Any help would be appreciated.

-Weston

It’s a delegate.

You can bind function pointers to it, for example

OnAudioFinished.BindUObject(this, &AMyPawn::AudioFinished);

AudioFinished can be in any class. You don’t need to make a custom AudioComponent for this, just functionality bound to the delegate.

Thanks for the quick response I’ll try that out asap.