Does UE4 optimize TArray Properties Replication already?
I uses TArray to store the list of player items. If player got many items, will add or remove items in the TArray cause the whole TArray elements copy to Client?
I can not find out the really working flows of TArray Properties Replications.
I hope some guys could help me figue out it or explain it.
Sorry for my poor English. You don’t understand, please point it out.
There is a way to get the old value of a replicated variable. Just pass an argument of the same type to the OnRep_Function() like this
/** declaration of a replciated actor array*/
UPROPERTY(Transient, BlueprintReadOnly, ReplicatedUsing = OnRep_Array)
TArray<class AActor*> ReplicatedActors;
void AYourActor::OnRep_Array(TArray<class AActor*> PreReplicationArray)
{
//ReplicatedActors has already been replicated as this point.
//PreReplicationArray has the values pre-replication.
}