@@ -974,7 +974,7 @@ private void AddInterpolatedState(NetworkTransformState newState)
974
974
/// <remarks>
975
975
/// <see cref="OnNetworkStateChanged"/>
976
976
/// </remarks>
977
- private void StopExtrapolatingLastState ( )
977
+ private void TryToStopExtrapolatingLastState ( )
978
978
{
979
979
if ( ! m_LastReceivedState . IsDirty || m_LastReceivedState . EndExtrapolationTick >= NetworkManager . LocalTime . Tick )
980
980
{
@@ -1006,9 +1006,15 @@ private void OnNetworkStateChanged(NetworkTransformState oldState, NetworkTransf
1006
1006
{
1007
1007
// This is "just in case" we receive a new state before the end
1008
1008
// of any currently applied and potentially extrapolating state.
1009
- StopExtrapolatingLastState ( ) ;
1009
+ // Attempts to stop extrapolating any previously applied state.
1010
+ TryToStopExtrapolatingLastState ( ) ;
1011
+
1012
+ // Add measurements for the new state's deltas
1010
1013
AddInterpolatedState ( newState ) ;
1014
+
1015
+ // Set the last received state to the new state (will be used to stop extrapolating the new state on the next local tick)
1011
1016
m_LastReceivedState = newState ;
1017
+
1012
1018
// Set the current local tick and wait until the next tick before we end
1013
1019
// this state's extrapolation.
1014
1020
m_LastReceivedState . EndExtrapolationTick = NetworkManager . LocalTime . Tick ;
@@ -1312,9 +1318,8 @@ protected virtual void Update()
1312
1318
// Apply the current authoritative state
1313
1319
ApplyAuthoritativeState ( ) ;
1314
1320
1315
- // Handles stopping extrapolation for any previously
1316
- // applied state.
1317
- StopExtrapolatingLastState ( ) ;
1321
+ // Attempts to stop extrapolating any previously applied state.
1322
+ TryToStopExtrapolatingLastState ( ) ;
1318
1323
}
1319
1324
}
1320
1325
0 commit comments