Skip to content

Commit df16b48

Browse files
committed
small fixes
1 parent 89ea413 commit df16b48

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

com.unity.netcode.gameobjects/Documentation~/advanced-topics/message-system/rpc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# RPC
22

3-
Any process can communicate with any other process by sending a remote procedure call (RPC). As of Netcode for GameObjects version 1.8.0, the `Rpc` attribute encompasses server to client RPCs, client to server RPCs, and client to client RPCs.
3+
Any process can communicate with any other process by sending a remote procedure call (RPC). The `Rpc` attribute is used to define who receives and executes the RPC.
44

55
![](../../images/sequence_diagrams/RPCs/ServerRPCs.png)
66

com.unity.netcode.gameobjects/Editor/CodeGen/NetworkBehaviourILPP.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ private void CreateNetworkVariableTypeInitializers(AssemblyDefinition assembly,
612612
private const string k_RpcAttribute_InvokePermission = nameof(RpcAttribute.InvokePermission);
613613

614614
#pragma warning disable CS0618 // Type or member is obsolete
615-
// Need to ignore the obsolete warning as the obsolete behaviour still needs to work
615+
// Need to ignore the obsolete warning as the obsolete behaviour still needs to work
616616
private const string k_ServerRpcAttribute_RequireOwnership = nameof(ServerRpcAttribute.RequireOwnership);
617617
#pragma warning restore CS0618 // Type or member is obsolete
618618

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public enum RpcInvokePermission
4040
}
4141

4242
/// <summary>
43-
/// <para>Represents the common base class for Rpc attributes.</para>
43+
/// <para>Marks a method as a remote procedure call (RPC).</para>
44+
/// <para>The marked method will be executed on all game instances defined by the <see cref="SendTo"/> target.</para>
4445
/// </summary>
4546
[AttributeUsage(AttributeTargets.Method)]
4647
public class RpcAttribute : Attribute
@@ -80,7 +81,7 @@ public struct RpcAttributeParams
8081
public RpcDelivery Delivery = RpcDelivery.Reliable;
8182

8283
/// <summary>
83-
/// Who has network permission to invoke this RPC
84+
/// Controls who has permission to invoke this RPC. The default setting is <see cref="RpcInvokePermission.Everyone"/>
8485
/// </summary>
8586
public RpcInvokePermission InvokePermission;
8687

@@ -90,7 +91,7 @@ public struct RpcAttributeParams
9091
/// <remarks>
9192
/// Deprecated in favor of <see cref="InvokePermission"/>.
9293
/// </remarks>
93-
[Obsolete("RequireOwnership is deprecated. Please use InvokePermission = RpcInvokePermission.Owner instead.")]
94+
[Obsolete("RequireOwnership is deprecated. Please use InvokePermission = RpcInvokePermission.Owner or InvokePermission = RpcInvokePermission.Everyone instead.")]
9495
public bool RequireOwnership;
9596

9697
/// <summary>
@@ -127,15 +128,14 @@ public class ServerRpcAttribute : RpcAttribute
127128
{
128129
/// <summary>
129130
/// When true, only the owner of the NetworkObject can invoke this ServerRpc.
130-
/// This property sets the base <see cref="RpcAttribute.InvokePermission"/> to <see cref="RpcInvokePermission.Owner"/> when "RequireOwnership = true" or to <see cref="RpcInvokePermission.Everyone"/> when "RequireOwnership = false". />.
131131
/// </summary>
132132
/// <remarks>
133-
/// Deprecated in favor of using <see cref="RpcAttribute"/> with <see cref="SendTo.Server"/> and an <see cref="RpcAttribute.InvokePermission"/>.
133+
/// <para> Deprecated in favor of using <see cref="RpcAttribute"/> with a <see cref="SendTo.Server"/> target and an <see cref="RpcAttribute.InvokePermission"/>.</para>
134134
/// <code>
135135
/// [ServerRpc(RequireOwnership = false)]
136136
/// // is replaced with
137137
/// [Rpc(SendTo.Server, InvokePermission = RpcInvokePermission.Everyone)]
138-
/// // or, as InvokePermission has a default setting of RpcInvokePermission.Everyone, you can also use
138+
/// // as InvokePermission has a default setting of RpcInvokePermission.Everyone, you can also use
139139
/// [Rpc(SendTo.Server)]
140140
/// </code>
141141
/// <code>

com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcInvocationTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Collections;
32
using System.Collections.Generic;
43
using System.Runtime.CompilerServices;
@@ -13,11 +12,11 @@ namespace Unity.Netcode.RuntimeTests.Rpc
1312
{
1413
[TestFixture(NetworkTopologyTypes.DistributedAuthority)]
1514
[TestFixture(NetworkTopologyTypes.ClientServer)]
16-
internal class RpcInvocationTests: NetcodeIntegrationTest
15+
internal class RpcInvocationTests : NetcodeIntegrationTest
1716
{
1817
protected override int NumberOfClients => 3;
1918

20-
public RpcInvocationTests(NetworkTopologyTypes topologyType) : base(topologyType) {}
19+
public RpcInvocationTests(NetworkTopologyTypes topologyType) : base(topologyType) { }
2120

2221
private GameObject m_Prefab;
2322

com.unity.netcode.gameobjects/Tests/Runtime/Rpc/RpcManyClientsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public void RpcManyClientsTest()
127127

128128
rpcManyClientsObject.ReceivedFrom.Clear();
129129
rpcManyClientsObject.Count = 0;
130-
var target = new [] { m_ClientNetworkManagers[1].LocalClientId, m_ClientNetworkManagers[2].LocalClientId };
130+
var target = new[] { m_ClientNetworkManagers[1].LocalClientId, m_ClientNetworkManagers[2].LocalClientId };
131131
param.Send.Target = rpcManyClientsObject.RpcTarget.Group(target, RpcTargetUse.Temp);
132132
rpcManyClientsObject.WithParamsClientRpc(param);
133133

0 commit comments

Comments
 (0)