Skip to content

Commit 39e476f

Browse files
committed
TMP
1 parent 54264cb commit 39e476f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,13 +1847,12 @@ internal void UpdatePositionSlerp()
18471847
/// is the owner being synchronized we don't want to synchronize with
18481848
/// the exception of the NetworkObject being owned by the server.
18491849
/// </summary>
1850-
private bool ShouldSynchronizeHalfFloat(ulong targetClientId)
1850+
private bool ShouldSynchronizeHalfFloat(NetworkManager networkManager, ulong targetClientId)
18511851
{
18521852
if (!IsServerAuthoritative() && NetworkObject.OwnerClientId == targetClientId)
18531853
{
18541854
// In distributed authority mode we want to synchronize the half float if we are the owner.
1855-
// TODO do we have a cached NetworkManager here? Should we create one?
1856-
return (!NetworkManager.DistributedAuthorityMode && NetworkObject.IsOwnedByServer) || (NetworkManager.DistributedAuthorityMode);
1855+
return (!networkManager.DistributedAuthorityMode && NetworkObject.IsOwnedByServer) || (networkManager.DistributedAuthorityMode);
18571856
}
18581857
return true;
18591858
}
@@ -2117,7 +2116,6 @@ internal bool ApplyTransformToNetworkState(ref NetworkTransformState networkStat
21172116
return CheckForStateChange(ref networkState);
21182117
}
21192118

2120-
//private int m_CachedTickRateValue;
21212119
/// <summary>
21222120
/// Applies the transform to the <see cref="NetworkTransformState"/> specified.
21232121
/// </summary>
@@ -2376,7 +2374,7 @@ private bool CheckForStateChange(ref NetworkTransformState networkState, bool is
23762374
}
23772375
else // If synchronizing is set, then use the current full position value on the server side
23782376
{
2379-
if (ShouldSynchronizeHalfFloat(targetClientId))
2377+
if (ShouldSynchronizeHalfFloat(m_CachedNetworkManager, targetClientId))
23802378
{
23812379
// If we have a NetworkDeltaPosition that has a state applied, then we want to determine
23822380
// what needs to be synchronized. For owner authoritative mode, the server side
@@ -2970,7 +2968,7 @@ private void ApplyTeleportingState(NetworkTransformState newState)
29702968
if (isSynchronization)
29712969
{
29722970
// Need to use NetworkManager vs m_CachedNetworkManager here since we are yet to be spawned
2973-
if (ShouldSynchronizeHalfFloat(NetworkManager.LocalClientId))
2971+
if (ShouldSynchronizeHalfFloat(NetworkManager, NetworkManager.LocalClientId))
29742972
{
29752973
m_HalfPositionState.HalfVector3.Axis = newState.NetworkDeltaPosition.HalfVector3.Axis;
29762974
m_HalfPositionState.DeltaPosition = newState.DeltaPosition;

0 commit comments

Comments
 (0)