[Multiplayer] Hidden actor gets deleted on client

Hey there,

I noticed when setting a replicated actor to be HiddenInGame=True on the server it will get deleted on clients. I need my actors to further exist on the client, as I do some stuff that is actually not necessary to be replicated → saving some bandwidth. Is there a suitable way of keeping the hidden actor on the client alive?

I found this problem to. Did you solve it?

We solved it by overriding AActor::SetActorHiddenInGame in C++. Do not propagate the call to parent if the parent is AActor. Instead hide the RootComponent and propagate it to the child components. This keeps the actor alive on the clients, but comes with new issues. If you had some components hidden for what ever reason, you will overwrite that by unhiding and need some other logic to handle this problem.

Yes, see my answer

Okey, i will use set visibility, it less functionaly but safety

I know this is an old question and already have been answered.

but, I have a different solution and I leave it here for a person in future who has same issue.

my solution is overriding ‘IsNetRelevantFor’ function to make to return true always.

this makes alive an actor even it is hidden in game.

You can just set
bAlwaysRelevant = true;