Preface
GameplayTask/AbilityTask is a node that completes various asynchronous tasks during the lifecycle of a game skill, such as waiting for a key press, waiting for target data, etc. But there is one node that is quite magical, called WaitNetSync. I find it quite magical that a seemingly small and concise node can ensure that both the server and client reach a certain point before executing subsequent operations. Let's take a look at my analysis.
NetworkSyncPoint (WaitNetSync) waits for network synchronization

This is an asynchronous node with a relatively complex internal implementation (it's surprising if you don't get dizzy after reading it), which ensures synchronization between the server and client through thegeneral network synchronization eventIf you don't understand, first look at my this article.
First, the invocation of this node requires both the server and client versionsto be called.
Although the internal code is all written in one node implementation, in network games, its execution flow is based on three types of synchronization, each type of synchronization has the server and client following different paths, ultimately forming six paths.
If it isa single-player game, calling this node is meaningless, regardless of which synchronization mode, after calling, OnSync will be executed immediately.
OnlyClientWait
- Client: When executing to this node, listen for the GenericSignalFromServer event on the corresponding ASC, passing in the OnSync callback (calling CallOrAddPrelicatedDelegate on ASC, at this time the Add operation is executed),wait forthe event to trigger, after the event triggers, execute OnSync to complete synchronization. The client needs to wait.
- Server: When executing to this node, trigger through RPCthe GenericSignalFromServer event that the client just listened to above (calling ClientSetReplicatedEvent on ASC), then the server's OnSync is called immediately. The server does not wait.

OnlyServerWait
- Server: When executing to this node, listen for the GenericSignalFromClient event on the corresponding ASC, passing in the OnSync callback (calling CallOrAddPrelicatedDelegate on ASC, at this time the Add operation is executed),wait forthe event to trigger, after the event triggers, execute OnSync to complete synchronization. The server needs to wait.
- Client: When executing to this node, trigger through RPCthe GenericSignalFromClient event that the server just listened to above (calling ClientSetReplicatedEvent on ASC), then the client's OnSync is called immediately. The client does not wait.

BothWait
- Client: When executing to this node, listen for the GenericSignalFromServer event on the corresponding ASC, passing in the OnSync callback (calling CallOrAddPrelicatedDelegate on ASC, at this time the Add operation is executed),wait forthe event to trigger, after the event triggers, execute OnSync to complete synchronization. The client needs to wait. At the same time, trigger theGenericSignalFromClient event that the server just listened to above.
- Server: When executing to this node, listen for the GenericSignalFromClient event on the corresponding ASC, passing in the OnSync callback (calling CallOrAddPrelicatedDelegate on ASC, at this time the Add operation is executed),wait forthe event to trigger, after the event triggers, execute OnSync to complete synchronization. The server needs to wait. At the same time, trigger theGenericSignalFromServer event that the client just listened to above.

Having written this, I can't help but say how wonderful it is! Finally, I sincerely suggest that to understand Unreal's source code, you should look at both the pure client and the listening server, as well as dedicated servers to fully understand.

