She left with yellow skin and came back with blue skin, why?


I’m in a multiplayer design. In the picture below, the yellow one is the host(server), both the red and the green are clients.

Then, the yellow(server) started to move away until she completely disappeared in the view sight of both clients.

Then, the yellow one turned back and started moving towards the red and the green. After the yellow came into the sight of the red and the green, it was found the yellow one’s skin has changed from yellow to blue.

Does anybody know why?

Note: The character blueprint used for all those 3 players are the same with blue skin skeletal mesh. I changed their skin colors during spawn process by overriding the function “Spawn Default Pawn For” inside GameMode blueprint.

try setting the color with a dynamic material instance and set it’s color with an on_repNotify function (this can be during game mode => post login).

Hello @3dRaven,

I’m not quite clear about your idea, could you give more explanation?

I’m thinking what variable I should choose and set its replication to “RepNotify” in order to use its OnRep function to change the skin color. Its OnRep function needs to be triggered as soon as the player is replicated back into the client’s machine.
No idea yet.

A workaround:
The problem can be solved by checking “Always relevant” of the character blueprint.
However, I feel this is not a decent approach because of heavier net traffic.

Is there an existing event that occurs exactly when a actor is in or out the range of NCDS(Net Cull Distance Squared)?

Or other idea?

Hello @3dRaven ,

After spending some time to learn exactly how RepNotify works, I finally got your idea and that’s indeed the solution of my problem.

I added an RepNotify variable inside the character blueprint and set its value to a different one than the default. After that, I can get notified as soon as the player was replicated back into a client machine. Setting skin colors can be done inside OnRep_ function of that variable.

Thanks a lot!