I am struggling to understand why I am unable to replicate TArray of custom UStructs in my component derived from AActorComponent.
My custom UStruct looks like this:
struct SURVIVALFPS_API FInventoryItem
UItemDataAsset* ItemRef = nullptr;
int Count = 0;
And array is declared as following:
UPROPERTY(VisibleAnywhere, ReplicatedUsing = OnRepItems)
When I modify the array at some specific index, it does not trigger replication, the only thing that triggers replication is resizing the array. If I change the type inside TArray to int, I observe the same behaviour. I checked in editor that the array is correctly modified on the server.
However, I am able to replicate single FInventoryItem just fine. The component is marked for replication, ReplicatedUsing function is marked as UFUNCTION, I have DOREPLIFETIME set up correctly; the replication works just fine for non-array types.
The weird thing is that I can replicate the same TArray in my actor class, but not on the component.
Any help is greatly appreciated.