TArray not allowed as interface parameter?

error C2511: ‘bool IDamageableInterface::CanBeDamagedByTeams(const TArray,FDefaultAllocator> &)’: overloaded member function not found in ‘IDamageableInterface’
note: see declaration of ‘IDamageableInterface’

class IDamageableInterface

	UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = "IDamageable")
	bool CanBeDamagedByTeams(TArray<ETeam> Teams);//, bool& CanBeDamaged // << error

Changing the parameter from a TArray back to a regular Eteam fixes the error.

I also tried adding the const-keyword to the parameter but that didn’t work either (same error). But this doesn’t seem required because the generated.h always adds the const-keyword it seems.

I tried changing the function-name. But that too did not work (same error).

This is the generated.h part:

IMPLEMENT_CLASS(UButton_Styled, 1496933788);
	bool IDamageableInterface::CanBeDamagedByTeams(const TArray<TEnumAsByte<ETeam> >& Teams)
		check(0 && "Do not directly call Event functions in Interfaces. Call Execute_CanBeDamagedByTeams instead.");
		DamageableInterface_eventCanBeDamagedByTeams_Parms Parms;
		return Parms.ReturnValue;

With the const addition you were almost there. The generated function header of blueprint implementable events expect TArrays to be passed by const reference, so this should work:

UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = "IDamageable")
     bool CanBeDamagedByTeams(const TArray<TEnumAsByte<ETeam>>& Teams);

The array is passed as const to make clear that the passed array is not modified. Its passed by reference for optimization, meaning so that the array contents are not copied onto the stack when the function is called. You may already know this, but I think in this case it helps to understand the design decision as to why UE forces TArrays to be passed by const reference.

The const reference only applies to the array in C++, because the array you receive in the blueprint graph will still be a copy that can be modified in the blueprint graph. Still, the const TArray& is to make clear to the C++ programmer that whatever changes are made to the array in blueprint aren’t visible in the original C++ array when the function finishes.

Edit: The TEnumAsByte<> is required as well when passing enum values to a blueprint implementable event. So in summary: TArrays and enums require a specific format. Your function header has to match the one that the compiler prints in the error.

Thanks for the very detailed answer. This info should be in the official documentation for interfaces.