diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
index 244cf831c3..2dba83f2be 100644
--- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
+++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
@@ -19,6 +19,7 @@ using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
using osu.Game.Configuration;
+using osu.Game.Rulesets.UI;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Objects.Drawables
@@ -126,6 +127,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
[CanBeNull]
private HitObjectLifetimeEntry lifetimeEntry;
+ [Resolved(CanBeNull = true)]
+ private DrawableRuleset drawableRuleset { get; set; }
+
///
/// Creates a new .
///
@@ -195,7 +199,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
foreach (var h in HitObject.NestedHitObjects)
{
- var drawableNested = CreateNestedHitObject(h) ?? throw new InvalidOperationException($"{nameof(CreateNestedHitObject)} returned null for {h.GetType().ReadableName()}.");
+ var drawableNested = drawableRuleset?.GetPooledDrawableRepresentation(h)
+ ?? CreateNestedHitObject(h)
+ ?? throw new InvalidOperationException($"{nameof(CreateNestedHitObject)} returned null for {h.GetType().ReadableName()}.");
drawableNested.OnNewResult += onNewResult;
drawableNested.OnRevertResult += onRevertResult;
@@ -203,6 +209,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
nestedHitObjects.Value.Add(drawableNested);
AddNestedHitObject(drawableNested);
+
+ drawableNested.OnParentReceived(this);
}
StartTimeBindable.BindTo(HitObject.StartTimeBindable);
@@ -291,6 +299,14 @@ namespace osu.Game.Rulesets.Objects.Drawables
{
}
+ ///
+ /// Invoked when this receives a new parenting .
+ ///
+ /// The parenting .
+ protected virtual void OnParentReceived(DrawableHitObject parent)
+ {
+ }
+
///
/// Invoked by the base to populate samples, once on initial load and potentially again on any change to the samples collection.
///