Why can't I use an array in my function declaration?

I’m trying to write an event in C++ I can hook into in blueprint, so my C++ code can queue up dialogue and my blueprint HUD display it. Doing this with a single instance of my struct works perfectly:

USTRUCT(Blueprintable)
struct FDialogueLine {
	GENERATED_BODY()
		UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Speech")
		FString line;
	
		UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Speech")
		FName speaker;
};


	UFUNCTION(Category = "Speech", BlueprintImplementableEvent)
	void DisplayDialogue(FDialogueLine dialogueLine);

However, if I try to alter the function dec to accept multiple lines of dialogue in a single call, the compiler throws an error, “‘void AHUDManager::DisplayDialogue(const TArray &)’: overloaded member function not found in ‘AHUDManager’”:

UFUNCTION(Category = "Speech", BlueprintImplementableEvent)
	void DisplayDialogue(TArray<FDialogueLine> dialogueLine);

That error sounds to me like it thinks I’m overriding an existing function, but AHUDManager inherits directly from AActor, so I know there isn’t some kind of weird namespace clash. I don’t provide a function definition (since the point is to write an event that blueprint can hook into), and there’s nothing named DisplayDialogue elsewhere in my project, so is there an obvious reason why this would be failing?

After looking for similiar problems I adapted my syntax based on Fail to pass TArray from C++ to Blueprint - Blueprint - Unreal Engine Forums , and found that the array works fine if I declare it like this:

UFUNCTION(Category = "Speech", BlueprintImplementableEvent)
void DisplayDialogue(const TArray<FDialogueLine>& dialogueLine);

I don’t know why it works, but it seems to :slight_smile: