Skip to content

Commit 84fe50f

Browse files
committed
Revert cleanup - to move to other branch
1 parent 75b7480 commit 84fe50f

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,13 +395,14 @@ private void CheckForInScenePlaced()
395395
/// <param name="destroy">Defaults to true, determines whether the <see cref="NetworkObject"/> will be destroyed.</param>
396396
public void DeferDespawn(int tickOffset, bool destroy = true)
397397
{
398-
// The DAMode message is logged first, as ownership locking isn’t allowed when not in DAMode, making it the most relevant message.
398+
// Ensure we log the DAMode message first as locking ownership is not allowed if not DA so the DA message is the most relevant.
399399
if (!NetworkManager.DistributedAuthorityMode)
400400
{
401401
if (NetworkManager.LogLevel <= LogLevel.Error)
402402
{
403403
NetworkLog.LogErrorServer($"[{name}] This method is only available in distributed authority mode.");
404404
}
405+
405406
return;
406407
}
407408

@@ -411,6 +412,7 @@ public void DeferDespawn(int tickOffset, bool destroy = true)
411412
{
412413
NetworkLog.LogErrorServer($"[{name}] Cannot defer despawn while not spawned.");
413414
}
415+
414416
return;
415417
}
416418

@@ -610,7 +612,7 @@ internal void RemoveOwnershipExtended(OwnershipStatusExtended extended)
610612
/// <returns>true or false depending upon lock operation's success</returns>
611613
public bool SetOwnershipLock(bool lockOwnership = true)
612614
{
613-
// The DAMode message is logged first, as ownership locking isn’t allowed when not in DAMode, making it the most relevant message.
615+
// Ensure we log the DAMode message first as locking ownership is not allowed if not DA so the DA message is the most relevant.
614616
if (!NetworkManager.DistributedAuthorityMode)
615617
{
616618
if (NetworkManager.LogLevel <= LogLevel.Error)
@@ -626,6 +628,7 @@ public bool SetOwnershipLock(bool lockOwnership = true)
626628
{
627629
NetworkLog.LogErrorServer($"[{name}][Attempted Lock While not spawned]");
628630
}
631+
629632
return false;
630633
}
631634

@@ -668,6 +671,7 @@ public bool SetOwnershipLock(bool lockOwnership = true)
668671
{
669672
SendOwnershipStatusUpdate();
670673
}
674+
671675
return true;
672676
}
673677

@@ -793,6 +797,7 @@ public OwnershipRequestStatus RequestOwnership()
793797
{
794798
NetworkLog.LogErrorServer($"[{name}][Invalid Operation] Cannot request ownership of an NetworkObject before it is spawned.");
795799
}
800+
796801
return OwnershipRequestStatus.InvalidOperation;
797802
}
798803
// Exit early the local client is already the owner
@@ -861,7 +866,7 @@ public OwnershipRequestStatus RequestOwnership()
861866
public OnOwnershipRequestedDelegateHandler OnOwnershipRequested;
862867

863868
/// <summary>
864-
/// Invoked by <see cref="ChangeOwnershipMessage"/>
869+
/// Invoked by ChangeOwnershipMessage
865870
/// </summary>
866871
/// <param name="clientRequestingOwnership">the client requesting ownership</param>
867872
internal void OwnershipRequest(ulong clientRequestingOwnership)
@@ -3399,6 +3404,7 @@ internal static NetworkObject Deserialize(in SerializedObject serializedObject,
33993404
{
34003405
Destroy(networkObject.gameObject);
34013406
}
3407+
34023408
return null;
34033409
}
34043410

@@ -3555,7 +3561,7 @@ internal void SceneChangedUpdate(Scene scene, bool notify = false)
35553561
OnMigratedToNewScene?.Invoke();
35563562

35573563
// Only the authority side will notify clients of non-parented NetworkObject scene changes
3558-
if (isAuthority && notify && transform.parent == null)
3564+
if (isAuthority && notify && !transform.parent)
35593565
{
35603566
NetworkManagerOwner.SceneManager.NotifyNetworkObjectSceneChanged(this);
35613567
}

0 commit comments

Comments
 (0)