diff --git a/Assets/Mirror/Core/Prediction/Prediction.cs b/Assets/Mirror/Core/Prediction/Prediction.cs index f38d6c373..05b2d8bb7 100644 --- a/Assets/Mirror/Core/Prediction/Prediction.cs +++ b/Assets/Mirror/Core/Prediction/Prediction.cs @@ -110,7 +110,11 @@ public static T CorrectHistory( // respect the limit // TODO unit test to check if it respects max size if (history.Count >= stateHistoryLimit) + { history.Dequeue(); + // if we remove one entry, then we also need to adjust the afterIndex + afterIndex -= 1; + } // unlike with SortedList, we don't insert corrections for RingBuffer. // we only correct the values after it since insertions would be awkward for RingBuffer.