diff --git a/osu.Game/Overlays/SkinEditor/SkinEditor.cs b/osu.Game/Overlays/SkinEditor/SkinEditor.cs
index f4a1bb7562..823456dddd 100644
--- a/osu.Game/Overlays/SkinEditor/SkinEditor.cs
+++ b/osu.Game/Overlays/SkinEditor/SkinEditor.cs
@@ -391,10 +391,10 @@ namespace osu.Game.Overlays.SkinEditor
return;
}
- if (skinComponentsContainer.IsLoaded)
+ if (skinComponentsContainer.ComponentsLoaded)
bindChangeHandler(skinComponentsContainer);
else
- skinComponentsContainer.OnLoadComplete += d => Schedule(() => bindChangeHandler((SkinnableContainer)d));
+ skinComponentsContainer.OnComponentsLoaded += onComponentsLoaded;
content.Child = new SkinBlueprintContainer(skinComponentsContainer);
@@ -428,6 +428,13 @@ namespace osu.Game.Overlays.SkinEditor
RequestPlacement = requestPlacement
});
+ void onComponentsLoaded(Drawable d)
+ {
+ SkinnableContainer container = (SkinnableContainer)d;
+ container.OnComponentsLoaded -= onComponentsLoaded;
+ Schedule(() => bindChangeHandler(container));
+ }
+
void requestPlacement(Type type)
{
if (!(Activator.CreateInstance(type) is ISerialisableDrawable component))
diff --git a/osu.Game/Skinning/SkinnableContainer.cs b/osu.Game/Skinning/SkinnableContainer.cs
index aad95ca779..720699e708 100644
--- a/osu.Game/Skinning/SkinnableContainer.cs
+++ b/osu.Game/Skinning/SkinnableContainer.cs
@@ -21,6 +21,11 @@ namespace osu.Game.Skinning
///
public partial class SkinnableContainer : SkinReloadableDrawable, ISerialisableDrawableContainer
{
+ ///
+ /// Invoked when the skinnable components of this container finish loading.
+ ///
+ public event Action? OnComponentsLoaded;
+
private Container? content;
///
@@ -67,6 +72,7 @@ namespace osu.Game.Skinning
AddInternal(wrapper);
components.AddRange(wrapper.Children.OfType());
ComponentsLoaded = true;
+ OnComponentsLoaded?.Invoke(this);
}, (cancellationSource = new CancellationTokenSource()).Token);
}
@@ -106,5 +112,12 @@ namespace osu.Game.Skinning
Reload();
}
+
+ protected override void Dispose(bool isDisposing)
+ {
+ base.Dispose(isDisposing);
+
+ OnComponentsLoaded = null;
+ }
}
}