Skip to content

Commit 73a0bf8

Browse files
committed
Fix opposite null check
1 parent 25e9577 commit 73a0bf8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

com.unity.netcode.gameobjects/Runtime/Components/NetworkTransform.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3763,7 +3763,7 @@ private void InternalInitialization(bool isOwnershipChange = false)
37633763
if (CanCommitToTransform)
37643764
{
37653765
// Make sure authority doesn't get added to updates (no need to do this on the authority side)
3766-
m_CachedNetworkManager.NetworkTransformRegistration(m_CachedNetworkObject, forUpdate, false);
3766+
m_CachedNetworkManager.NetworkTransformRegistration(NetworkObject, forUpdate, false);
37673767
if (UseHalfFloatPrecision)
37683768
{
37693769
m_HalfPositionState = new NetworkDeltaPosition(currentPosition, m_CachedNetworkManager.ServerTime.Tick, math.bool3(SyncPositionX, SyncPositionY, SyncPositionZ));
@@ -3792,7 +3792,7 @@ private void InternalInitialization(bool isOwnershipChange = false)
37923792
m_PreviousScaleLerpSmoothing = ScaleLerpSmoothing;
37933793

37943794
// Non-authority needs to be added to updates for interpolation and applying state purposes
3795-
m_CachedNetworkManager.NetworkTransformRegistration(m_CachedNetworkObject, forUpdate, true);
3795+
m_CachedNetworkManager.NetworkTransformRegistration(NetworkObject, forUpdate, true);
37963796
// Remove this instance from the tick update
37973797
DeregisterForTickUpdate(this);
37983798
ResetInterpolatedStateToCurrentAuthoritativeState();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ private bool InternalHasAuthority()
11681168
/// <summary>
11691169
/// Gets if the object is owned by the local player or if the object is the local player object
11701170
/// </summary>
1171-
public bool IsOwner => IsSpawned && OwnerClientId == NetworkManager.LocalClientId;
1171+
public bool IsOwner => IsSpawned && OwnerClientId == NetworkManagerOwner.LocalClientId;
11721172

11731173
/// <summary>
11741174
/// Gets Whether or not the object is owned by anyone
@@ -2247,7 +2247,7 @@ public bool TrySetParent(NetworkObject parent, bool worldPositionStays = true)
22472247

22482248
internal bool InternalTrySetParent(NetworkObject parent, bool worldPositionStays = true)
22492249
{
2250-
if (!parent && (IsSpawned ^ parent.IsSpawned) && !NetworkManager.ShutdownInProgress)
2250+
if (parent && (IsSpawned ^ parent.IsSpawned) && !NetworkManager.ShutdownInProgress)
22512251
{
22522252
if (NetworkManager.LogLevel <= LogLevel.Developer)
22532253
{
@@ -2454,7 +2454,7 @@ internal bool ApplyNetworkParenting(bool removeParent = false, bool ignoreNotSpa
24542454
// has been set, this will not be entered into again (i.e. the later code will be invoked and
24552455
// users will get notifications when the parent changes).
24562456
var isInScenePlaced = IsSceneObject.HasValue && IsSceneObject.Value;
2457-
if (!transform.parent && !removeParent && !m_LatestParent.HasValue && isInScenePlaced)
2457+
if (transform.parent && !removeParent && !m_LatestParent.HasValue && isInScenePlaced)
24582458
{
24592459
var parentNetworkObject = transform.parent.GetComponent<NetworkObject>();
24602460

0 commit comments

Comments
 (0)