Can't compile with TArray as parameter in BlueprintImplementableEvent

I am using 4.16 from github.
To repro, add code such as the following to a class’s header file.

UFUNCTION(BlueprintImplementableEvent, Category = "Test")
void TestEvent(TArray<float> Data);

Hey BlackRang666,

I tested this and I also got the same compiler error. However, looking at the error, it appears that it’s looking for

void AMyActor::TestEvent(const TArray &)’: overloaded member function not found in ‘AMyActor’

Try

 void TestEvent(TArray<float>& Data);

instead of

 void TestEvent(TArray<float> Data);

After making that change, I was able to compile successfully. Let me know if this works for you.

Have a great day

1 Like

Would that not pass an address to the data instead of the data itself?

That’s correct, it’ll pass the address. That’s what BlueprintImplementableEvent expects, so it appears to be working as intended in this case.

BlueprintImplementableEvent is intended to only expect references? Sorry, I never saw that in the docs. I guess the actual bug is that you can use non-referenced parameters if they are not TArrays.

Tried your solution out of curiosity and the major problem is that in blueprints it makes that a return parameter, not an input. Kinda the opposite of what I wanted to start with.

Gotcha, so I’ve done some more testing and spoke to our developers and this appears to be working as intended.

However, for what you’re describing, I’m thinking the following line of code would give you the results you’re looking for:

UFUNCTION(BlueprintImplementableEvent, Category = "Test")
void TestFunction(const TArray& TestArray);

Is BlueprintImplementableEvent is intended to only expect references?

We are just trying to avoid copying types that are expensive to copy (like containers or arrays)

Additional snippet of information as well:
In Blueprint, arrays are always passed around as reference, the presence of ‘const’ indicates whether it’s an input or output parameter on the callfunction node

2 Likes