Unreal Engine 4.x Scripting with C++ Cookbook - Second Edition
by John P. Doran, William Sherif, Stephen Whittle
How it works...
Property replication is simple in theory. Whenever a variable changes its value, the network should notify all clients of the change and then update the variable. This is often used for things like health, where the value is extremely important to know.
When you register a variable like this, this variable should only be modified by the server and then replicated to the other clients. To mark something to be replicated, we use the Replicated specifier inside of the UPROPERTY.
After marking something as replicated, we have to define a new function called GetLifetimeReplicatedProps, which does not need to be declared in the header file. Inside of this function, we use the DOREPLIFETIME macro to state that whenever the JumpCount ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access