@@ -1625,6 +1625,7 @@ internal bool SynchronizeScale
16251625 /// this <see cref="NetworkBehaviour"/> derived class instance.
16261626 /// </summary>
16271627 protected NetworkManager m_CachedNetworkManager ;
1628+ private int m_CachedTickRate ;
16281629
16291630 /// <summary>
16301631 /// Helper method that returns the space relative position of the transform.
@@ -2136,9 +2137,8 @@ private bool CheckForStateChange(ref NetworkTransformState networkState, bool is
21362137 // We compare against the NetworkTickSystem version since ServerTime is set when updating ticks
21372138 if ( UseUnreliableDeltas && ! isSynchronization && m_DeltaSynch && m_NextTickSync <= CurrentTick )
21382139 {
2139- // TODO-CACHE: m_CachedNetworkManager.NetworkConfig.TickRate value
21402140 // Increment to the next frame synch tick position for this instance
2141- m_NextTickSync += ( int ) m_CachedNetworkManager . NetworkConfig . TickRate ;
2141+ m_NextTickSync += m_CachedTickRate ;
21422142 // If we are teleporting, we do not need to send a frame synch for this tick slot
21432143 // as a "frame synch" really is effectively just a teleport.
21442144 isAxisSync = ! flagStates . IsTeleportingNextFrame ;
@@ -3729,6 +3729,7 @@ private void InternalInitialization(bool isOwnershipChange = false)
37293729 return ;
37303730 }
37313731 m_CachedNetworkObject = NetworkObject ;
3732+ m_CachedTickRate = ( int ) m_CachedNetworkManager . NetworkConfig . TickRate ;
37323733
37333734 // Determine if this is the first NetworkTransform in the associated NetworkObject's list
37343735 m_IsFirstNetworkTransform = m_CachedNetworkObject . NetworkTransforms [ 0 ] == this ;
@@ -4802,7 +4803,7 @@ public NetworkTransformTickRegistration(NetworkManager networkManager)
48024803 internal void RegisterForTickSynchronization ( )
48034804 {
48044805 s_TickSynchPosition ++ ;
4805- m_NextTickSync = m_CachedNetworkManager . ServerTime . Tick + ( s_TickSynchPosition % ( int ) m_CachedNetworkManager . NetworkConfig . TickRate ) ;
4806+ m_NextTickSync = m_CachedNetworkManager . ServerTime . Tick + ( s_TickSynchPosition % m_CachedTickRate ) ;
48064807 }
48074808
48084809 private static void RegisterNetworkManagerForTickUpdate ( NetworkManager networkManager )
0 commit comments