How to make an AActor only visible/not visible to me?

What I’m trying to do is spawn two dummy characters on death.

first one = only visible to me, playing first person death anim/ragdoll simulation

second one = only visible to other players(except me), playing default death anim/ragdoll simulation.

I’ve successfully spawned two dummy characters on death, playing the right death effects.

But, I’m stuck at visibility issues.

The naive way would be to just add a field to the dummy that says which character can see it. When the dummy is replicated, if the local player isn’t that character - then set it to invisible. This works, but is prone to hackers since the object still exists on all clients.

The better way is to use Replication Graph and only send the dummy to the appropriate player, so other players have no clue it even exists.

The playercontroller class tracks actors hidden only to that player controller. You could possibly use that (I’ve seen others do it this way but I haven’t tried it myself).

From the header (there are associated methods if you search for that).

/** The actors which the camera shouldn't see - e.g. used to hide actors which the camera penetrates */
TArray<class AActor*> HiddenActors;