how do i replicate the material of the HOST player pawn to the client, after the client joins the host server.
In the game mode blueprint i used the postlogin event to load the save data of the incoming player, and apply the save data material to its pawn, This only works for the Host game mode, but not on the client.
-The easy way is spawn the cars when all clients are ready.
-You can use a event “Rep_Notify” too.
Create a Dynamic Matrial instance and override de Zero elemet.
But there’s no way to know when clients are ready, this client is joining the host from a lobby menu, so i can’t use pawn Begin play as that will work for the client’s car, but the host car will not update
I wait for them. When I have enough players controllers then i spawn them at the same time.
But, the second option would work too… So maybe you must choice it so you won’t make dramatic changes in your code.
RepNotify
Create a material var and set it to rep_notify. In the OnRep Function that is auto created you apply those materials to the asset.
The game mode handles spawning, so set the material var on the pawn/vehicle in the game mode when the pawn is initially spawned. The OnRep function will fire as soon as the value(s) are set.
Replication will pass those values to all other connected clients. The onrep function will apply the changes.
FYI, RepNotify values have to be set on the server (Authority) for them to be broadcast to all connected players.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.