Skip to content

Commit 0e2dc4e

Browse files
update
Updating XML API documentation for RpcTargetUse.
1 parent 1a66fb4 commit 0e2dc4e

File tree

1 file changed

+19
-0
lines changed
  • com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets

1 file changed

+19
-0
lines changed

com.unity.netcode.gameobjects/Runtime/Messaging/RpcTargets/RpcTarget.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,28 @@ public enum SendTo
6767
SpecifiedInParams
6868
}
6969

70+
/// <summary>
71+
/// This parameter controls the use of a particular performance optimization in situations where it can be used.<br />
72+
/// Because BaseRpcTarget is a managed type, allocating a new one is expensive, as it puts pressure on the garbage collector.
73+
/// </summary>
74+
/// <remarks>
75+
/// When using a <see cref="Temp"/> allocation type for the RPC target(s):<br />
76+
/// You typically don't need to worry about persisting the <see cref="BaseRpcTarget"/> generated.
77+
/// When using a <see cref="Persistent"/> allocation type for the RPC target(s): <br />
78+
/// You will want to use <see cref="RpcTarget"/>, which returns <see cref="BaseRpcTarget"/>, during <see cref="NetworkBehaviour"/> initialization (i.e. <see cref="NetworkBehaviour.OnNetworkPostSpawn"/>) and it to a property.<br />
79+
/// Then, When invoking the RPC, you would use your <see cref="BaseRpcTarget"/> which is a persisted allocation of a given set of client identifiers.
80+
/// !! Important !!<br />
81+
/// You will want to invoke <see cref="BaseRpcTarget.Dispose"/> of any persisted properties created via <see cref="RpcTarget"/> when despawning or destroying the associated <see cref="NetworkBehaviour"/> component's <see cref="NetworkObject"/>. Not doing so will result in small memory leaks.
82+
/// </remarks>
7083
public enum RpcTargetUse
7184
{
85+
/// <summary>
86+
/// Creates a temporary <see cref="BaseRpcTarget"/> used for the frame an <see cref="RpcAttribute"/> decorated method is invoked.
87+
/// </summary>
7288
Temp,
89+
/// <summary>
90+
/// Creates a persisted <see cref="BaseRpcTarget"/> that does not change and persists until it is disposed.
91+
/// </summary>
7392
Persistent
7493
}
7594

0 commit comments

Comments
 (0)