Hi, I have placed a actor in the level, when PIE, all client and server have this actor. It make sense, because this actor like kind of static data
contained in level asset, so the actor will be loaded when level loaded.
What confused me is when the server destroy this actor, other client’s actor will also disapper in the level, it doesn’t make sense, because I never set its bReplicate
to true.
What’s going on there, why and how?
Hi likemango2,
You’re right that deleting an unreplicated object on the server shouldn’t automatically delete it in a client. Here I’ve got the server deleting the an unreplicated cube blueprint on the right, and it keeps existing on the client on the left.
First thing I’d check is if the object calling the code is accidentally being replicated. In the example above, I’ve written the code in the GameMode blueprint, which is an object that only exists on the server.
If I would instead call a Remote Procedure Call function on the GameState blueprint, and then that ended up calling the destroy function, it would destroy it in both places.
If you’re using blueprints, a good way to check is to breakpoint the destroy function itself with the F9 key. If it’s accidentally being called on both client and server, you’ll see the breakpoint trigger twice. The field that says “No debug object selected” changes to something with (Server) in the name one time, and (Client) in the name another time.
Hope this helps!
the level would be loaded by the server, so its owned by the server. if you dont want this you can turn off NetLoadOnClient on the actor