Update comments for SyncVar (#3792)

The current comments for SyncVar is somewhat misleading. That is to say, it is mentioned in the comments that SyncVar can only be modified on the server side, and will be automatically synchronized to the client. But in fact, if syncDirection is set to ClientToServer, SyncVar should be modified on the client and automatically synchronized to the server and other clients. The same error exists in the comments of hook attribute
This commit is contained in:
F_CIL 2024-03-23 18:58:42 +08:00 committed by MrGadget
parent 5c52e78b10
commit 06f0a4b291

View File

@ -4,8 +4,12 @@
namespace Mirror namespace Mirror
{ {
/// <summary> /// <summary>
/// SyncVars are used to synchronize a variable from the server to all clients automatically. /// SyncVars are used to automatically synchronize a variable between the server and all clients. The direction of synchronization depends on the Sync Direction property, ServerToClient by default.
/// <para>Value must be changed on server, not directly by clients. Hook parameter allows you to define a client-side method to be invoked when the client gets an update from the server.</para> /// <para>
/// When Sync Direction is equal to ServerToClient, the value should be changed on the server side and synchronized to all clients.
/// Otherwise, the value should be changed on the client side and synchronized to server and other clients.
/// </para>
/// <para>Hook parameter allows you to define a method to be invoked when gets an value update. Notice that the hook method will not be called on the change side.</para>
/// </summary> /// </summary>
[AttributeUsage(AttributeTargets.Field)] [AttributeUsage(AttributeTargets.Field)]
public class SyncVarAttribute : PropertyAttribute public class SyncVarAttribute : PropertyAttribute