Skip to content

Commit 9ef01ba

Browse files
authored
fix: Improve API doc for OnGainedOwnership and OnLostOwnership (#2997)
1 parent af564b6 commit 9ef01ba

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviour.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,8 @@ internal void InternalOnNetworkDespawn()
806806
}
807807

808808
/// <summary>
809-
/// Gets called when the local client gains ownership of this object.
809+
/// In client-server contexts, this method is invoked on both the server and the local client of the owner when <see cref="Netcode.NetworkObject"/> ownership is assigned.
810+
/// <para>In distributed authority contexts, this method is only invoked on the local client that has been assigned ownership of the associated <see cref="Netcode.NetworkObject"/>.</para>
810811
/// </summary>
811812
public virtual void OnGainedOwnership() { }
812813

@@ -834,7 +835,9 @@ internal void InternalOnOwnershipChanged(ulong previous, ulong current)
834835
}
835836

836837
/// <summary>
837-
/// Gets called when ownership of this object is lost.
838+
/// In client-server contexts, this method is invoked on the local client when it loses ownership of the associated <see cref="Netcode.NetworkObject"/>
839+
/// and on the server when any client loses ownership.
840+
/// <para>In distributed authority contexts, this method is only invoked on the local client that has lost ownership of the associated <see cref="Netcode.NetworkObject"/>.</para>
838841
/// </summary>
839842
public virtual void OnLostOwnership() { }
840843

@@ -1138,7 +1141,7 @@ internal void WriteNetworkVariableData(FastBufferWriter writer, ulong targetClie
11381141
// Distributed Authority: All clients have read permissions, always try to write the value.
11391142
if (NetworkVariableFields[j].CanClientRead(targetClientId))
11401143
{
1141-
// Write additional NetworkVariable information when length safety is enabled or when in distributed authority mode
1144+
// Write additional NetworkVariable information when length safety is enabled or when in distributed authority mode
11421145
if (ensureLengthSafety || distributedAuthority)
11431146
{
11441147
// Write the type being serialized for distributed authority (only for comb-server)

0 commit comments

Comments
 (0)