Properties using push model replicate without being manually marked as dirty

I’m trying to use the push model for replicating properties. But the properties simply replicate as usual, without me marking anything as dirty manually. Which is the whole point.

Here’s my code:

// header file
UPROPERTY(ReplicatedUsing=OnRep_TestInt)
int TestInt;

// cpp file
void AMyPlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
	Super::GetLifetimeReplicatedProps(OutLifetimeProps);

	FDoRepLifetimeParams SharedParams;
	SharedParams.bIsPushBased = true;

	DOREPLIFETIME_WITH_PARAMS_FAST(AMyPlayerState, TestInt, SharedParams);
}

void AMyPlayerState::SetTestInt(int NewValue)
{
  TestInt = NewValue;
}

I use the setter method to change TestInt value on a PlayerState object on the server. But because I don’t mark the property as dirty, I would expect the OnRep_TestInt method to never fire on client side. But it calls it regardless of me marking the property dirty or not. Is this a bug or am I just misunderstanding how the push model is supposed to work?

Ever found an answer?

Check this

I’m wondering the same thing, any info on this ?

I was also having this problem, of variables replicating even when not dirty. My test was to have a breakpoint in an OnRep function, in code.

My issue was because the Actor I was testing it with was re-spawned every time I executed an action to test the replication of changes. And every time an Actor spawns, it replicates its initial property states. So, there was that, I was being dumb.

Once I started testing with properties within a persistent component, it was working as expected: initial replication and no following ones until marking the property dirty. If I commented out the code that marks the properties dirty, it wouldn’t replicate after the initial replication, regardless of changes on the server.

TLDR: it seems the system is working as expected, at least in UE 5.4. And if you’re having issues, make sure it’s not a mistake on your way of testing it, like it was for me haha

1 Like