I can’t seem to declare an array of Interfactes. It can be done in blueprints so I assume there is a way to do it in C++
I’ve tried:
UFUNCTION(BlueprintCallable, Category = "Cell Tile")
TArray<TScriptInterface<IDamageableEntity>> GetAllEntitiesInDirection(int _Count, EMoveDirection _TileToMoveTo);
which gives a link errror:
error LNK2019: unresolved external
symbol “public: class TArray TScriptInterface IDamageableEntity>,class
FDefaultAllocator> __cdecl
ACellTile::GetAllEntitiesInDirection(int,enum
EMoveDirection)”
(?GetAllEntitiesInDirection@ACellTile@@QEAA?AV?$TArray@V?$TScriptInterface@VIDamageableEntity@@@@VFDefaultAllocator@@@@HW4EMoveDirection@@@Z)
referenced in function "void __cdecl
dynamic initializer for 'Z_CompiledInDeferEnum_UEnum_ECellTypeResourceID''(void)" (??__EZ_CompiledInDeferEnum_UEnum_ECellTypeResourceID@@YAXXZ)
And I’ve tried
UFUNCTION(BlueprintCallable, Category = "Cell Tile")
TArray<IDamageableEntity*> GetAllDamageablesInDirection(int _Count, EMoveDirection _TileToMoveTo);
which gives this error:
error C2679: binary ‘=’: no operator
found which takes a right-hand operand
of type ‘TArray *,FDefaultAllocator>’ (or there is no acceptable conversion) note: could be
‘TArray,FDefaultAllocator>
&TArray,FDefaultAllocator>::operator
=(TArray,FDefaultAllocator>
&&)’
I’ve made sure I’m #including “Runtime/CoreUObject/Public/UObject/ScriptInterface.h”
What’s the correct way to declare an Array of interface pointers?