[4.6.1] Set Is Replicated causing StaticMeshComponent duplication
I will describe the steps I did which led me to this issue (using blueprints):
1) Set the actor blueprint property
2) Set the value of
3) Dynamically add the second
4) Set the value of
5) There are now three Static Meshes rendered in the actor.
Does anybody know if this is an issue with a solution or is this simply an engine bug?
asked Feb 04 '15 at 05:49 PM in Bug Reports
I managed to resolve the issue by getting rid of the Set Is Replicated nodes and making the variable of DeltaRELCombine (the one which is set after calculations and determines where the new StaticMesh should be placed) RepNotify. In the On Rep function I implemented the StaticMeshComponent addition so that it executes both on the client and the server in the same way. I also had to play with the dynamic material instances a bit as they where replicated only upon some significant events.
Thank you very much for your support :)
answered Feb 07 '15 at 01:07 PM
So in this test project, the initial cube is replicated as expected, because the Actor is set to Replicate in its defaults. The Switch Has Authority node is making it so only the instance of this BP on the Server is adding StaticMeshComponents, so those won't show up on the Client. If you then SetIsReplicated to true for the components, those components will also be replicated. This works as I would expect it to.
If you delete the SwitchHasAuthority node while Replicates is set to true, the instance on the Server is replicating the code on the Client, so the Client will see both its own added static mesh and another added from the Server (though it won't be at the same location, it'll be at its own random location). This is probably what you were seeing initially.
The best way to get this working the way you'd like, where the Blueprint exists in the level at start, and spawns a new static mesh component on the server and replicates that to the client, is to have Replicates set to True, Switch Has Authority for the random generation, and then SetIsReplicated to True for the added meshes.
answered Feb 06 '15 at 09:15 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here