diff --git a/HitScoreVisualizer/HarmonyPatches/FlyingScoreSpawnerPatch.cs b/HitScoreVisualizer/HarmonyPatches/FlyingScoreSpawnerPatch.cs new file mode 100644 index 0000000..13e35a1 --- /dev/null +++ b/HitScoreVisualizer/HarmonyPatches/FlyingScoreSpawnerPatch.cs @@ -0,0 +1,18 @@ +using SiraUtil.Affinity; +using UnityEngine; + +namespace HitScoreVisualizer.HarmonyPatches; + +internal class FlyingScoreSpawnerPatch : IAffinity +{ + [AffinityPrefix] + [AffinityPriority(1000)] + [AffinityPatch(typeof(FlyingScoreSpawner), nameof(FlyingScoreSpawner.SpawnFlyingScoreNextFrame))] + internal bool SpawnFlyingScoreNextFrame(FlyingScoreSpawner __instance, IReadonlyCutScoreBuffer cutScoreBuffer, Color color) + { + // The scoring element owns a pooled CutScoreBuffer. If spawning is deferred for a frame, + // the element can be despawned and its buffer reused for another note before it is read. + __instance.SpawnFlyingScore(cutScoreBuffer, color); + return false; + } +} diff --git a/HitScoreVisualizer/Installers/HsvPlayerInstaller.cs b/HitScoreVisualizer/Installers/HsvPlayerInstaller.cs index ca9babf..28ab8e5 100644 --- a/HitScoreVisualizer/Installers/HsvPlayerInstaller.cs +++ b/HitScoreVisualizer/Installers/HsvPlayerInstaller.cs @@ -33,6 +33,7 @@ public override void InstallBindings() // Patches Container.BindInterfacesTo().AsSingle(); Container.BindInterfacesTo().AsSingle(); + Container.BindInterfacesTo().AsSingle(); Container.BindInterfacesTo().AsSingle(); } -} \ No newline at end of file +}