Replicate some values to some connections only?

Hi!

How can I replicate some values to some connections only? The owner can’t be set to any specific player.

Not being able to control which data that goes to which client will force me to use some “proxy actor” solution. Spawning a “proxy actor” for every player with the player’s playercontroller as the owner. This would allow to not send all replicated u-properties to all players but isn’t a very elegant solution.

Why use proxy actors if there is Player State created for this purpose?

If you have some data the only one client must see or some function called on some client - place it inside Player State and tell server replicate it only to owner.

Like this:

void UMyPlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty> &OutLifetimeProps) const
{
	Super::GetLifetimeReplicatedProps(OutLifetimeProps);
	DOREPLIFETIME_CONDITION(UMyPlayerState, MySomeData, COND_OwnerOnly);
}

Hi!

The question may have been a bit unclear, sorry for that. I can’t set the owner since some players may need to see the actor but not always all and not always one. The properties that are to be replicated aren’t related to the owner property at all. This must be done per channel.

I believe it would be better to just get the playercontroller for the player in question when deciding if replication should happen. E.g. PreReplication could have a playercontroller parameter saying which player we are replicating to. I know the system doesn’t work this way today but it’s just an abstract idea.

Should I turn this into a feature request or is it already possible to solve without the “actor proxy solution”?

Thanks in advance!

I added a feature request instead since from what I understand this isn’t supported out of the box today.