using System; using UnityEngine; namespace Mirror { /// /// 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. /// /// 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. /// /// 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. /// [AttributeUsage(AttributeTargets.Field)] public class SyncVarAttribute : PropertyAttribute { public string hook; } /// /// Call this from a client to run this function on the server. /// Make sure to validate input etc. It's not possible to call this from a server. /// [AttributeUsage(AttributeTargets.Method)] public class CommandAttribute : Attribute { public int channel = Channels.Reliable; public bool requiresAuthority = true; } /// /// The server uses a Remote Procedure Call (RPC) to run this function on clients. /// [AttributeUsage(AttributeTargets.Method)] public class ClientRpcAttribute : Attribute { public int channel = Channels.Reliable; public bool includeOwner = true; } /// /// The server uses a Remote Procedure Call (RPC) to run this function on a specific client. /// [AttributeUsage(AttributeTargets.Method)] public class TargetRpcAttribute : Attribute { public int channel = Channels.Reliable; } /// /// Only an active server will run this method. /// Prints a warning if a client or in-active server tries to execute this method. /// [AttributeUsage(AttributeTargets.Method)] public class ServerAttribute : Attribute {} /// /// Only an active server will run this method. /// No warning is thrown. /// [AttributeUsage(AttributeTargets.Method)] public class ServerCallbackAttribute : Attribute {} /// /// Only an active client will run this method. /// Prints a warning if the server or in-active client tries to execute this method. /// [AttributeUsage(AttributeTargets.Method)] public class ClientAttribute : Attribute {} /// /// Only an active client will run this method. /// No warning is printed. /// [AttributeUsage(AttributeTargets.Method)] public class ClientCallbackAttribute : Attribute {} /// /// Converts a string property into a Scene property in the inspector /// public class SceneAttribute : PropertyAttribute {} /// /// Used to show private SyncList in the inspector, /// Use instead of SerializeField for non Serializable types /// [AttributeUsage(AttributeTargets.Field)] public class ShowInInspectorAttribute : Attribute {} /// /// Used to make a field readonly in the inspector /// [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] public class ReadOnlyAttribute : PropertyAttribute {} /// /// When defining multiple Readers/Writers for the same type, indicate which one Weaver must use. /// [AttributeUsage(AttributeTargets.Method)] public class WeaverPriorityAttribute : Attribute {} }