Keep custom battle open during lobby updates (#8790)

This commit is contained in:
2026-07-25 19:39:54 -07:00
committed by GitHub
parent 3add561a82
commit 6ff2a91417
@@ -780,12 +780,12 @@ public class ConnectionHandler : MonoBehaviour, ILobbySubscriber, IDisposable {
fetchedNewGameLeaders.AddRange(lobbyResponse.NewGameOptions.AvailableLeaders);
MainQueue.Q.Enqueue(() => {
// Skip lobby UI updates if we've already left the connection UI.
// The lobby response may arrive after the game has started (e.g., when creating a new
// game), and the connection canvas is inactive, causing GetComponentInParent to fail.
// This check must be inside the queue callback since the state may change between
// when the response arrives and when this callback executes.
if (!IsConnectionModeActive()) return;
// Skip lobby UI updates if we've already left the connection UI or opened the custom
// battle panel. A lobby response may already be in flight when either transition
// happens, so it must not switch the visible panel back to the lobby.
// This check must be inside the queue callback since the state may change between when
// the response arrives and when this callback executes.
if (!IsConnectionModeActive() || customBattlePanel.gameObject.activeSelf) return;
ResourceFetcher.headshotFetcher.Prefetch(
fetchedNewGameLeaders.Select(a => a.ImagePath));