Skip to content

Commit 806a3a8

Browse files
committed
NetworkObject corrections
1 parent b79641a commit 806a3a8

File tree

2 files changed

+88
-34
lines changed

2 files changed

+88
-34
lines changed

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

Lines changed: 88 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -512,22 +512,27 @@ public enum OwnershipStatus
512512
/// When set, this instance will have no permissions (i.e. cannot distribute, transfer, etc).
513513
/// </summary>
514514
None = 0,
515+
515516
/// <summary>
516517
/// When set, this instance will be automatically redistributed when a client joins (if not locked or no request is pending) or leaves.
517518
/// </summary>
518519
Distributable = 1 << 0,
520+
519521
/// <summary>
520522
/// When set, a non-owner can obtain ownership immediately (without requesting and as long as it is not locked).
521523
/// </summary>
522524
Transferable = 1 << 1,
525+
523526
/// <summary>
524527
/// When set, a non-owner must request ownership from the owner (will always get locked once ownership is transferred).
525528
/// </summary>
526529
RequestRequired = 1 << 2,
530+
527531
/// <summary>
528532
/// When set, only the current session owner may have ownership over this object.
529533
/// </summary>
530534
SessionOwner = 1 << 3,
535+
531536
/// <summary>
532537
/// Used within the inspector view only. When selected it will set the Distributable, Transferable, and RequestRequired flags or if those flags are already set it will select the SessionOwner flag by itself.
533538
/// </summary>
@@ -627,10 +632,29 @@ public bool SetOwnershipLock(bool lockOwnership = true)
627632
/// </summary>
628633
public enum OwnershipPermissionsFailureStatus
629634
{
635+
/// <summary>
636+
/// The NetworkObject is locked and ownership cannot be acquired
637+
/// </summary>
630638
Locked,
639+
640+
/// <summary>
641+
/// The NetworkObject requires an ownership request via RequestOwnership
642+
/// </summary>
631643
RequestRequired,
644+
645+
/// <summary>
646+
/// The NetworkObject is already processing an ownership request and ownership cannot be acquired at this time
647+
/// </summary>
632648
RequestInProgress,
649+
650+
/// <summary>
651+
/// The NetworkObject does not have the OwnershipStatus.Transferable flag set and ownership cannot be acquired
652+
/// </summary>
633653
NotTransferrable,
654+
655+
/// <summary>
656+
/// The NetworkObject has the OwnershipStatus.SessionOwner flag set and ownership cannot be acquired
657+
/// </summary>
634658
SessionOwnerOnly
635659
}
636660

@@ -658,11 +682,35 @@ public enum OwnershipPermissionsFailureStatus
658682
/// </summary>
659683
public enum OwnershipRequestStatus
660684
{
685+
/// <summary>
686+
/// The request for ownership was sent (does not mean it will be granted, but the request was sent)
687+
/// </summary>
661688
RequestSent,
689+
690+
/// <summary>
691+
/// The current client is already the owner (no need to request ownership)
692+
/// </summary>
662693
AlreadyOwner,
694+
695+
/// <summary>
696+
/// The OwnershipStatus.RequestRequired flag is not set on this NetworkObject
697+
/// </summary>
663698
RequestRequiredNotSet,
699+
700+
/// <summary>
701+
/// The current owner has locked ownership which means requests are not available at this time
702+
/// </summary
664703
Locked,
704+
705+
/// <summary>
706+
/// There is already a known request in progress. You can scan for ownership changes and try again
707+
/// after a specific period of time or no longer attempt to request ownership
708+
/// </summary>
665709
RequestInProgress,
710+
711+
/// <summary>
712+
/// This object is marked as SessionOwnerOnly and therefore cannot be requested
713+
/// </summary>
666714
SessionOwnerOnly,
667715
}
668716

@@ -820,19 +868,31 @@ internal void OwnershipRequest(ulong clientRequestingOwnership)
820868
/// <summary>
821869
/// What is returned via <see cref="OnOwnershipRequestResponse"/> after an ownership request has been sent via <see cref="RequestOwnership"/>
822870
/// </summary>
823-
/// <remarks>
824-
/// Approved: Granted ownership, and returned after the requesting client has gained ownership on the local instance.
825-
/// Locked: Was locked after request was sent.
826-
/// RequestInProgress: A request started before this request was received.
827-
/// CannotRequest: The RequestRequired status changed while the request was in flight.
828-
/// Denied: General denied message that is only set if <see cref="OnOwnershipRequested"/> returns false by the authority instance.
829-
/// </remarks>
830871
public enum OwnershipRequestResponseStatus
831872
{
873+
/// <summary>
874+
/// The ownership request was approved and the requesting client has gained ownership on the local instance
875+
/// </summary>
832876
Approved,
877+
878+
/// <summary>
879+
/// The ownership request was denied because the object became locked after the request was sent
880+
/// </summary>
833881
Locked,
882+
883+
/// <summary>
884+
/// The ownership request was denied because another request was already in progress when this request was received
885+
/// </summary>
834886
RequestInProgress,
887+
888+
/// <summary>
889+
/// The ownership request was denied because the RequestRequired status changed while the request was in flight
890+
/// </summary>
835891
CannotRequest,
892+
893+
/// <summary>
894+
/// The ownership request was denied by the authority instance (<see cref="OnOwnershipRequested"/> returned false)
895+
/// </summary>
836896
Denied,
837897
}
838898

@@ -867,8 +927,19 @@ internal void OwnershipRequestResponse(OwnershipRequestResponseStatus ownershipR
867927
/// </summary>
868928
public enum OwnershipLockActions
869929
{
930+
/// <summary>
931+
/// No additional locking action will be performed
932+
/// </summary>
870933
None,
934+
935+
/// <summary>
936+
/// Sets the specified ownership flags and then locks the NetworkObject
937+
/// </summary>
871938
SetAndLock,
939+
940+
/// <summary>
941+
/// Sets the specified ownership flags and then unlocks the NetworkObject
942+
/// </summary>
872943
SetAndUnlock
873944
}
874945

@@ -1165,6 +1236,7 @@ public void SetSceneObjectStatus(bool isSceneObject = false)
11651236
/// Delegate type for checking visibility
11661237
/// </summary>
11671238
/// <param name="clientId">The clientId to check visibility for</param>
1239+
/// <returns>True if the object should be visible to the specified client, false otherwise</returns>
11681240
public delegate bool VisibilityDelegate(ulong clientId);
11691241

11701242
/// <summary>
@@ -1176,6 +1248,7 @@ public void SetSceneObjectStatus(bool isSceneObject = false)
11761248
/// Delegate type for checking spawn options
11771249
/// </summary>
11781250
/// <param name="clientId">The clientId to check spawn options for</param>
1251+
/// <returns>True if the object should be spawned for the specified client, false otherwise</returns>
11791252
public delegate bool SpawnDelegate(ulong clientId);
11801253

11811254
/// <summary>
@@ -2649,6 +2722,14 @@ internal bool SetNetworkVariableData(FastBufferReader reader, ulong clientId)
26492722
return true;
26502723
}
26512724

2725+
/// <summary>
2726+
/// Gets the order index of a NetworkBehaviour instance within the ChildNetworkBehaviours collection
2727+
/// </summary>
2728+
/// <param name="instance">The NetworkBehaviour instance to find the index for</param>
2729+
/// <returns>
2730+
/// The index of the NetworkBehaviour in the ChildNetworkBehaviours collection.
2731+
/// Returns 0 if the instance is not found.
2732+
/// </returns>
26522733
public ushort GetNetworkBehaviourOrderIndex(NetworkBehaviour instance)
26532734
{
26542735
// read the cached index, and verify it first

pvpExceptions.json

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,33 +41,6 @@
4141
"Unity.Netcode.NetworkManager: void NetworkUpdate(NetworkUpdateStage): undocumented",
4242
"Unity.Netcode.NetworkManager.ReanticipateDelegate: undocumented",
4343
"Unity.Netcode.NetworkObject: void SetSceneObjectStatus(bool): undocumented",
44-
"Unity.Netcode.NetworkObject: ushort GetNetworkBehaviourOrderIndex(NetworkBehaviour): undocumented",
45-
"Unity.Netcode.NetworkObject.OwnershipStatus: None: undocumented",
46-
"Unity.Netcode.NetworkObject.OwnershipStatus: Distributable: undocumented",
47-
"Unity.Netcode.NetworkObject.OwnershipStatus: Transferable: undocumented",
48-
"Unity.Netcode.NetworkObject.OwnershipStatus: RequestRequired: undocumented",
49-
"Unity.Netcode.NetworkObject.OwnershipStatus: SessionOwner: undocumented",
50-
"Unity.Netcode.NetworkObject.OwnershipPermissionsFailureStatus: Locked: undocumented",
51-
"Unity.Netcode.NetworkObject.OwnershipPermissionsFailureStatus: RequestRequired: undocumented",
52-
"Unity.Netcode.NetworkObject.OwnershipPermissionsFailureStatus: RequestInProgress: undocumented",
53-
"Unity.Netcode.NetworkObject.OwnershipPermissionsFailureStatus: NotTransferrable: undocumented",
54-
"Unity.Netcode.NetworkObject.OwnershipPermissionsFailureStatus: SessionOwnerOnly: undocumented",
55-
"Unity.Netcode.NetworkObject.OwnershipRequestStatus: RequestSent: undocumented",
56-
"Unity.Netcode.NetworkObject.OwnershipRequestStatus: AlreadyOwner: undocumented",
57-
"Unity.Netcode.NetworkObject.OwnershipRequestStatus: RequestRequiredNotSet: undocumented",
58-
"Unity.Netcode.NetworkObject.OwnershipRequestStatus: Locked: undocumented",
59-
"Unity.Netcode.NetworkObject.OwnershipRequestStatus: RequestInProgress: undocumented",
60-
"Unity.Netcode.NetworkObject.OwnershipRequestStatus: SessionOwnerOnly: undocumented",
61-
"Unity.Netcode.NetworkObject.OwnershipRequestResponseStatus: Approved: undocumented",
62-
"Unity.Netcode.NetworkObject.OwnershipRequestResponseStatus: Locked: undocumented",
63-
"Unity.Netcode.NetworkObject.OwnershipRequestResponseStatus: RequestInProgress: undocumented",
64-
"Unity.Netcode.NetworkObject.OwnershipRequestResponseStatus: CannotRequest: undocumented",
65-
"Unity.Netcode.NetworkObject.OwnershipRequestResponseStatus: Denied: undocumented",
66-
"Unity.Netcode.NetworkObject.OwnershipLockActions: None: undocumented",
67-
"Unity.Netcode.NetworkObject.OwnershipLockActions: SetAndLock: undocumented",
68-
"Unity.Netcode.NetworkObject.OwnershipLockActions: SetAndUnlock: undocumented",
69-
"Unity.Netcode.NetworkObject.VisibilityDelegate: missing <returns>",
70-
"Unity.Netcode.NetworkObject.SpawnDelegate: missing <returns>",
7144
"Unity.Netcode.CustomMessagingManager.HandleNamedMessageDelegate: missing <param name=\"senderClientId\">",
7245
"Unity.Netcode.CustomMessagingManager.HandleNamedMessageDelegate: missing <param name=\"messagePayload\">",
7346
"Unity.Netcode.GenerateSerializationForGenericParameterAttribute: .ctor(int): undocumented",

0 commit comments

Comments
 (0)