Why doesn't a class derived from TArray work with delegates?

I have derived a class from TArray to add some functionality.

2

But my derived class doesn’t work with delegates.

TArray is not a UCLASS and it works.

0

I don’t understand it. Why does this happen?
Thank you so much

A lot of code in the engine exists that specifically handles TArray’s to make them supported even if they aren’t marked UCLASS/USTRUCT. UnrealHeaderTool complains since your FScoreCardDataArray isn’t marked as UCLASS/USTRUCT. Even if you do, UHT may then complain that TArray isn’t allowed as a base.

Depends on your use case but I’d probably drop the class entirely and use TArray directly. You can write a free static function in a BlueprintFunctionLibrary that internally uses TArray::IndexOfByPredicate instead to find an element by PlayerID.

1 Like

Ok, I will do it as you say since there is no other alternative.
Thank you very much for your help

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.