Skip to content

Commit eace6b8

Browse files
style
Updating some comments based on AI suggestions.
1 parent 42e3d83 commit eace6b8

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

com.unity.netcode.gameobjects/Runtime/Components/Helpers/AttachableBehaviour.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,8 @@ public void Attach(AttachableNode attachableNode)
467467
/// </summary>
468468
internal void InternalDetach()
469469
{
470+
// If this instance is not in the middle of being destroyed, the attachable node is not null, and the node is not destroying
471+
// =or= the scene it is located in is in the middle of being unloaded, then re-parent under the default parent.
470472
if (!IsDestroying && m_AttachableNode && (!m_AttachableNode.IsDestroying || m_AttachableNode.gameObject.scene.isLoaded))
471473
{
472474
if (m_DefaultParent)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,11 +644,10 @@ protected NetworkBehaviour GetNetworkBehaviour(ushort behaviourId)
644644
public ulong OwnerClientId { get; internal set; }
645645

646646
/// <summary>
647-
/// Returns true if the NetworkObject is in the middle of being destroyed or
648-
/// if there is no valid assigned NetworkObject.
647+
/// Returns true if the NetworkObject is in the middle of being destroyed.
649648
/// </summary>
650649
/// <remarks>
651-
/// <see cref="NetworkObject.IsDestroying"/>
650+
/// <see cref="SetIsDestroying"/>
652651
/// </remarks>
653652
internal bool IsDestroying { get; private set; }
654653

@@ -675,6 +674,7 @@ protected internal virtual void OnIsDestroying()
675674
/// </remarks>
676675
internal void SetIsDestroying()
677676
{
677+
// We intentionally invoke this before setting the IsDestroying flag.
678678
OnIsDestroying();
679679
IsDestroying = true;
680680
}

0 commit comments

Comments
 (0)