From 57e3f20cba14d6433437d5ed07d415f942545659 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Sat, 27 Jun 2026 21:00:57 -0500 Subject: [PATCH] Improve role option garbage collection further --- .../Patches/Options/RoleSettingMenuPatches.cs | 18 ++++++++++++------ MiraAPI/Utilities/Extensions.cs | 4 ---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs index 082cc9c..d123161 100644 --- a/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs +++ b/MiraAPI/Patches/Options/RoleSettingMenuPatches.cs @@ -178,6 +178,7 @@ public static class RoleSettingMenuPatches .ThenBy(x => x.Key.Name); var quotaThing = __instance.categoryHeaderEditRoleOrigin.transform.FindChild("QuotaHeader"); + var usingNewQuota = false; var template = __instance.transform.parent.parent.GetComponent().GameSettingsTab.categoryHeaderOrigin; foreach (var grouping in sortedRoleGroups) @@ -216,12 +217,17 @@ public static class RoleSettingMenuPatches var countText = quotaInst.transform.FindChild("# Text"); countText.transform.localPosition = new Vector3(1.9f, 0.0993f, 0f); - var blankLabel = quotaInst.transform.FindChild("BlankLabel").gameObject; - var chanceLabel = quotaInst.transform.FindChild("Chance Label").gameObject; - var countLabel = quotaInst.transform.FindChild("# Label").gameObject; - blankLabel.DeepDestroy(false); - chanceLabel.DeepDestroy(false); - countLabel.DeepDestroy(false); + if (!usingNewQuota) + { + var blankLabel = quotaInst.transform.FindChild("BlankLabel").gameObject; + var chanceLabel = quotaInst.transform.FindChild("Chance Label").gameObject; + var countLabel = quotaInst.transform.FindChild("# Label").gameObject; + blankLabel.DeepDestroy(false); + chanceLabel.DeepDestroy(false); + countLabel.DeepDestroy(false); + usingNewQuota = true; + quotaThing = quotaInst; + } categoryHeaderMasked.Background.sprite = MiraAssets.CategoryHeader.LoadAsset(); categoryHeaderMasked.Background.sprite.texture.filterMode = FilterMode.Bilinear; diff --git a/MiraAPI/Utilities/Extensions.cs b/MiraAPI/Utilities/Extensions.cs index 882a15c..e9ad300 100644 --- a/MiraAPI/Utilities/Extensions.cs +++ b/MiraAPI/Utilities/Extensions.cs @@ -335,10 +335,6 @@ public static class Extensions /// public static void ClearGarbageCollector() { - if (!MainMenuManagerPatches.NeedsDeepDestroy) - { - return; - } Coroutines.Start(CoFreeResources()); }