From a3960bf7155f6019dd552783b2266f7896df2d34 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 May 2024 14:17:28 +0800 Subject: [PATCH] Add inline comment explaining `LifetimeEnd` set for future visitors --- .../Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs index e70e181a50..7841e65935 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs @@ -240,6 +240,13 @@ namespace osu.Game.Rulesets.UI.Scrolling // always load the hitobject before its first judgement offset entry.LifetimeStart = Math.Min(entry.HitObject.StartTime - entry.HitObject.MaximumJudgementOffset, computedStartTime); + + // This is likely not entirely correct, but sets a sane expectation of the ending lifetime. + // A more correct lifetime will be overwritten after a DrawableHitObject is assigned via DrawableHitObject.updateState. + // + // It is required that we set a lifetime end here to ensure that in scenarios like loading a Player instance to a seeked + // location in a beatmap doesn't churn every hit object into a DrawableHitObject. Even in a pooled scenario, the overhead + // of this can be quite crippling. entry.LifetimeEnd = entry.HitObject.GetEndTime() + timeRange.Value; }