UE4 project replication issue

Hello guys! Need help with replication issue.

Try to change shown (FString) attack status but seems that variable replication doesn’t work.

Cross post from here with code examples and screenshot: FULL description

github: https://github.com/AInsolence/Multiplayer_02/blob/main/Source/Multiplayer_02/Private/Components/MoveReplicationComponent.cpp

Any hints and advices will be really appreciated!

Based on what I see, I think you need to also implement a client function. Right now, it looks like you have correctly implemented the server function.

  Server_AttackStatus("Attack_01");

This needs to get called by the clients, telling the server to run the attack status function for them.

In the server implementation of the function, you need to call the client function for all other clients to also update their strings. You can set it to multicast if you don’t care about reliability too much.

Thank you for sharing your thoughts man.

I’ve found the solution: I’ve lost “const” modifier in the end of

GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const

It’s a tricky mistake, cause this function without “const” hide a parent function and replication is not working eventually. I’ve seen this warning (not error!) in VS with successful compilation in editor at the same time.

Be careful with that guys), good luck in your projects!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms