diff --git a/osu.Game/Skinning/SkinReloadableDrawable.cs b/osu.Game/Skinning/SkinReloadableDrawable.cs
index b6b9650048..c7b33dc539 100644
--- a/osu.Game/Skinning/SkinReloadableDrawable.cs
+++ b/osu.Game/Skinning/SkinReloadableDrawable.cs
@@ -27,6 +27,30 @@ namespace osu.Game.Skinning
///
protected ISkinSource CurrentSkin { get; private set; } = null!;
+ [BackgroundDependencyLoader]
+ private void load(ISkinSource source)
+ {
+ CurrentSkin = source;
+ CurrentSkin.SourceChanged += onChange;
+ }
+
+ protected override void LoadAsyncComplete()
+ {
+ base.LoadAsyncComplete();
+ skinChanged();
+ }
+
+ ///
+ /// Force any pending calls to be performed immediately.
+ ///
+ ///
+ /// When a skin change occurs, the handling provided by this class is scheduled.
+ /// In some cases, such a sample playback, this can result in the sample being played
+ /// just before it is updated to a potentially different sample.
+ ///
+ /// Calling this method will ensure any pending update operations are run immediately.
+ /// It is recommended to call this before consuming the result of skin changes for anything non-drawable.
+ ///
protected void FlushPendingSkinChanges()
{
if (pendingSkinChange == null)
@@ -36,11 +60,12 @@ namespace osu.Game.Skinning
pendingSkinChange = null;
}
- [BackgroundDependencyLoader]
- private void load(ISkinSource source)
+ ///
+ /// Called when a change is made to the skin.
+ ///
+ /// The new skin.
+ protected virtual void SkinChanged(ISkinSource skin)
{
- CurrentSkin = source;
- CurrentSkin.SourceChanged += onChange;
}
private void onChange()
@@ -51,12 +76,6 @@ namespace osu.Game.Skinning
pendingSkinChange = Scheduler.Add(skinChanged);
}
- protected override void LoadAsyncComplete()
- {
- base.LoadAsyncComplete();
- skinChanged();
- }
-
private void skinChanged()
{
SkinChanged(CurrentSkin);
@@ -65,14 +84,6 @@ namespace osu.Game.Skinning
pendingSkinChange = null;
}
- ///
- /// Called when a change is made to the skin.
- ///
- /// The new skin.
- protected virtual void SkinChanged(ISkinSource skin)
- {
- }
-
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);