I have a replicated actor, and I want to hide it only for the character that interacts with it. I partially achieved this, but there is a problem: when the server interacts with the actor, it affects all clients.
void ABaseCharacter::Interact(ABaseItem* Item)
{
ServerInteract(Item);
}
void ABaseCharacter::ServerInteract_Implementation(ABaseItem* Item)
{
if (Item)
{
Item->SetOwner(this);
}
MulticastInteract(Item);
}
void ABaseCharacter::MulticastInteract_Implementation(ABaseItem* Item)
{
if (IsLocallyControlled())
{
Item->SetActorHiddenInGame(true);
}
}