Hi,
I have a custom event that is set to Run on Server
and the Reliable
property is set to true. It is launched upon left clicking on the corresponding actor and adds a StaticMeshComponent
to it. The property Should Replicate
is then set to true for the new component (on event begin play it is also enabled for the starting component). Everything works perfectly fine on the listen server. However, there are some weird occurences on the Client.
I will try to describe the problem as briefly as possible.
Basically when the actor enters a certain volume, the player is able to attach new StaticMeshComponents to it. The dynamic material instances (initiated on the event begin play) adjust themselves so as to tell the player where are the valid places for the addition of a new static mesh (valid are painted in green, invalid in red). When a player clicks a valid place a new StaticMeshComponent
is added using the above-mentioned custom event. If the character leaves the volume, all of the dynamic material instances go back to normal. All of this is what a player can see on the listen server.
On the client happens something different. None of the dynamic material instances are altered when the actor enters a volume (and this is actually what I need, because the first player should not see the valid places of StaticMesh addition for the second player). When the StaticMeshComponent is added and set to Should Replicate on the server, the client sees three StaticMeshes rendered instead of two. Surprisingly, one of the static meshes rendered suddenly has the dynamic material instances adjusted to green and red, not to mention the fact, that there are actually two static meshes in the client’s array of Static Mesh Components references for that actor. Still the script runs only on the server and the array is not set to be replicated, so it should remain with only one element throughout the entire gameplay. I don’t understand that really…
Here are some screenshots depicting the problem:
-Server (Player 1)-
-Client (Player 2)-
In the volume after addition The green glimmer in the middle of the actor is the third rendered static mesh which somehow has the dynamic material instances altered.
Thank you in advance for any feedback or help