Skip to content

Commit 94f662c

Browse files
committed
RpcAttributes corrections
1 parent 48e407b commit 94f662c

File tree

2 files changed

+44
-13
lines changed

2 files changed

+44
-13
lines changed

com.unity.netcode.gameobjects/Runtime/Messaging/RpcAttributes.cs

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,29 @@ public enum RpcDelivery
2424
[AttributeUsage(AttributeTargets.Method)]
2525
public class RpcAttribute : Attribute
2626
{
27-
// Must match the set of parameters below
27+
/// <summary>
28+
/// Parameters that define the behavior of an RPC attribute
29+
/// </summary>
2830
public struct RpcAttributeParams
2931
{
32+
/// <summary>
33+
/// Specifies the delivery method for the RPC
34+
/// </summary>
3035
public RpcDelivery Delivery;
36+
37+
/// <summary>
38+
/// When true, only the owner of the object can execute this RPC
39+
/// </summary>
3140
public bool RequireOwnership;
41+
42+
/// <summary>
43+
/// When true, local execution of the RPC is deferred until the next network tick
44+
/// </summary>
3245
public bool DeferLocal;
46+
47+
/// <summary>
48+
/// When true, allows the RPC target to be overridden at runtime
49+
/// </summary>
3350
public bool AllowTargetOverride;
3451
}
3552

@@ -38,10 +55,26 @@ public struct RpcAttributeParams
3855
/// Type of RPC delivery method
3956
/// </summary>
4057
public RpcDelivery Delivery = RpcDelivery.Reliable;
58+
59+
/// <summary>
60+
/// When true, only the owner of the object can execute this RPC
61+
/// </summary>
4162
public bool RequireOwnership;
63+
64+
/// <summary>
65+
/// When true, local execution of the RPC is deferred until the next network tick
66+
/// </summary>
4267
public bool DeferLocal;
68+
69+
/// <summary>
70+
/// When true, allows the RPC target to be overridden at runtime
71+
/// </summary>
4372
public bool AllowTargetOverride;
4473

74+
/// <summary>
75+
/// Initializes a new instance of the RpcAttribute with the specified target
76+
/// </summary>
77+
/// <param name="target">The target for this RPC</param>
4578
public RpcAttribute(SendTo target)
4679
{
4780
}
@@ -60,8 +93,15 @@ private RpcAttribute()
6093
[AttributeUsage(AttributeTargets.Method)]
6194
public class ServerRpcAttribute : RpcAttribute
6295
{
96+
/// <summary>
97+
/// When true, only the owner of the NetworkObject can invoke this ServerRpc.
98+
/// This property overrides the base RpcAttribute.RequireOwnership.
99+
/// </summary>
63100
public new bool RequireOwnership;
64101

102+
/// <summary>
103+
/// Initializes a new instance of ServerRpcAttribute that targets the server
104+
/// </summary>
65105
public ServerRpcAttribute() : base(SendTo.Server)
66106
{
67107

@@ -75,6 +115,9 @@ public ServerRpcAttribute() : base(SendTo.Server)
75115
[AttributeUsage(AttributeTargets.Method)]
76116
public class ClientRpcAttribute : RpcAttribute
77117
{
118+
/// <summary>
119+
/// Initializes a new instance of ClientRpcAttribute that targets all clients except the server
120+
/// </summary>
78121
public ClientRpcAttribute() : base(SendTo.NotServer)
79122
{
80123

pvpExceptions.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,6 @@
4545
"Unity.Netcode.CustomMessagingManager.HandleNamedMessageDelegate: missing <param name=\"messagePayload\">",
4646
"Unity.Netcode.GenerateSerializationForGenericParameterAttribute: .ctor(int): undocumented",
4747
"Unity.Netcode.GenerateSerializationForTypeAttribute: .ctor(Type): undocumented",
48-
"Unity.Netcode.RpcAttribute: RequireOwnership: undocumented",
49-
"Unity.Netcode.RpcAttribute: DeferLocal: undocumented",
50-
"Unity.Netcode.RpcAttribute: AllowTargetOverride: undocumented",
51-
"Unity.Netcode.RpcAttribute: .ctor(SendTo): undocumented",
52-
"Unity.Netcode.RpcAttribute.RpcAttributeParams: undocumented",
53-
"Unity.Netcode.RpcAttribute.RpcAttributeParams: Delivery: undocumented",
54-
"Unity.Netcode.RpcAttribute.RpcAttributeParams: RequireOwnership: undocumented",
55-
"Unity.Netcode.RpcAttribute.RpcAttributeParams: DeferLocal: undocumented",
56-
"Unity.Netcode.RpcAttribute.RpcAttributeParams: AllowTargetOverride: undocumented",
57-
"Unity.Netcode.ServerRpcAttribute: RequireOwnership: undocumented",
58-
"Unity.Netcode.ServerRpcAttribute: .ctor(): undocumented",
59-
"Unity.Netcode.ClientRpcAttribute: .ctor(): undocumented",
6048
"Unity.Netcode.StaleDataHandling: undocumented",
6149
"Unity.Netcode.StaleDataHandling: Ignore: undocumented",
6250
"Unity.Netcode.StaleDataHandling: Reanticipate: undocumented",

0 commit comments

Comments
 (0)