Hello everyone,
I have a problem calling a “Run on owning Client” RPC in my Player Character BP in the BeginPlay event. Below is the code I am trying to execute, nothing fancy.
When testing it in multiplayer with 2 players (one as listen server), the CL_Print event gets called twice on the server.
Output of the print string is this:
I can fix this easily by adding a delay node (~ 1-2s) right before calling the CL_Print event in BeginPlay. The print string then shows me this:
However I know that this is just a workaround and not ideal as you shouldn’t use delay nodes, it would take some time for the connected clients to do the stuff in the CL_Print event and with high latencies a fixed delay time maybe wouldn’t always fit.
Dirty hack (used to debug only) is to add a delay on begin play. Do 0.5s if playing from editor.
The reason this is a dirty hack is you cannot predict the delay for every possible connection, nor processing speeds of every pc configuration.
Proper fix is to have the client RPC the server when it’s ready. Then Server can RPC back whatever it wants. You need to dig into conditional flow logic pertaining to Proxies.
Get Local Role
is locally Controlled
Is Server, Is Dedicated Server