From d3bce25ef6f1d3776c9bfcbbc0be4b849e68167d Mon Sep 17 00:00:00 2001 From: ReAdmin <170283204+rewalo@users.noreply.github.com> Date: Thu, 8 Oct 2026 20:49:11 -0700 Subject: [PATCH] Guard EnsurePanel and expose TriggerPreload --- MiraAPI/Patches/RoleGuidePatches.cs | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/MiraAPI/Patches/RoleGuidePatches.cs b/MiraAPI/Patches/RoleGuidePatches.cs index 3e520a5..e3b134a 100644 --- a/MiraAPI/Patches/RoleGuidePatches.cs +++ b/MiraAPI/Patches/RoleGuidePatches.cs @@ -168,6 +168,16 @@ public static class RoleGuidePatches Coroutines.Start(CoPreload(__instance)); } + public static void TriggerPreload(MatchInfoGuide instance) + { + if (!instance || _populate != null) + { + return; + } + + Coroutines.Start(CoPreload(instance)); + } + private static IEnumerator CoPreload(MatchInfoGuide instance) { while (instance && (!HudManager.InstanceExists || !GameManager.Instance)) @@ -801,9 +811,18 @@ public static class RoleGuidePatches return; } - var panel = Object.Instantiate( - _guide!.MatchInfoRolePanelPrefab, - entry.Modifier != null ? _modifiersScroller.Inner : _rolesScroller.Inner); + if (!_guide || !_guide!.MatchInfoRolePanelPrefab) + { + return; + } + + var parent = entry.Modifier != null ? _modifiersScroller?.Inner : _rolesScroller?.Inner; + if (parent == null) + { + return; + } + + var panel = Object.Instantiate(_guide!.MatchInfoRolePanelPrefab, parent); if (entry.Modifier != null) { panel.SetModifierPanel(entry.Modifier, entry.Amount, entry.Chance);