using System; namespace Unity.Netcode { /// /// RPC delivery types /// public enum RpcDelivery { /// /// Reliable delivery /// Reliable = 0, /// /// Unreliable delivery /// Unreliable } /// /// Represents the common base class for Rpc attributes. /// [AttributeUsage(AttributeTargets.Method)] public class RpcAttribute : Attribute { // Must match the set of parameters below public struct RpcAttributeParams { public RpcDelivery Delivery; public bool RequireOwnership; public bool DeferLocal; public bool AllowTargetOverride; } // Must match the fields in RemoteAttributeParams /// /// Type of RPC delivery method /// public RpcDelivery Delivery = RpcDelivery.Reliable; public bool RequireOwnership; public bool DeferLocal; public bool AllowTargetOverride; public RpcAttribute(SendTo target) { } // To get around an issue with the release validator, RuntimeAccessModifiersILPP will make this 'public' private RpcAttribute() { } } /// /// Marks a method as ServerRpc. /// A ServerRpc marked method will be fired by a client but executed on the server. /// [AttributeUsage(AttributeTargets.Method), Obsolete] public class ServerRpcAttribute : RpcAttribute { public new bool RequireOwnership; public ServerRpcAttribute() : base(SendTo.Server) { } } /// /// Marks a method as ClientRpc. /// A ClientRpc marked method will be fired by the server but executed on clients. /// [AttributeUsage(AttributeTargets.Method), Obsolete] public class ClientRpcAttribute : RpcAttribute { public ClientRpcAttribute() : base(SendTo.NotServer) { } } }