1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 00:47:24 +08:00

Ensure that file is imported and caches are invalidated before placing new sprites

This commit is contained in:
Dean Herbert 2022-04-01 15:49:05 +09:00
parent 314ad63c6e
commit bfd3406f5f

View File

@ -48,6 +48,9 @@ namespace osu.Game.Skinning.Editor
[Resolved]
private OsuColour colours { get; set; }
[Resolved]
private RealmAccess realm { get; set; }
[Resolved(canBeNull: true)]
private SkinEditorOverlay skinEditorOverlay { get; set; }
@ -347,6 +350,11 @@ namespace osu.Game.Skinning.Editor
skins.AddFile(skinInfo, contents, file.Name);
});
// Even though we are 100% on an update thread, we need to wait for realm callbacks to fire (to correctly invalidate caches in RealmBackedResourceStore).
// See https://github.com/realm/realm-dotnet/discussions/2634#discussioncomment-2483573 for further discussion.
// This is the best we can do for now.
realm.Run(r => r.Refresh());
// place component
placeComponent(new SkinnableSprite
{