ScenarioPicker: find the list's ScrollRect while the panel is still inactive (play mode builds it before showing it); verify builds the real list inactive

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-10-23 01:40:51 +02:00
commit 2fb8e88fcf
3 changed files with 7 additions and 4 deletions

View file

@ -85,12 +85,14 @@ public static class ScenarioPickerVerify
var groups = real ? ScenarioPickerCapture.AllGroups() : oneGroup
? new List<(string label, Scenario[] scenarios)> { ("modes", screen.A) }
: new List<(string label, Scenario[] scenarios)> { ("modes", screen.A), ("development", screen.B), ("test arenas", screen.C) };
// The menu builds a panel while it is inactive and shows it afterwards; the picker must find its scroll all the same.
if (real) list.gameObject.SetActive(false);
screen.Picker = ScenarioPicker.Show(list, detail, groups, screen.Launched.Add, () => screen.Backs++, menu.Dialog.Confirm);
var buttons = list.GetComponentsInChildren<PropertyButton>(false).Where(button => !button.transform.IsChildOf(detail.transform)).Select(button => button.Button).ToArray();
screen.Rows = buttons.Take(buttons.Length - 1).ToArray();
screen.Back = buttons.Last();
screen.Launch = detail.GetComponentsInChildren<Button>(false).Single();
if (real) Layout(menu, list, detail);
if (real) { list.gameObject.SetActive(true); Layout(menu, list, detail); }
return screen;
}

View file

@ -177,7 +177,8 @@ public sealed class ScenarioPicker
_scroll.onValueChanged.AddListener(_fit);
}
private static ScrollRect ScrollOf(PropertiesPanel panel) => (panel.Content ?? panel.transform).GetComponentInParent<ScrollRect>();
// The panel is inactive until the menu shows it, which is after Show builds it; an inactive ScrollRect still counts.
private static ScrollRect ScrollOf(PropertiesPanel panel) => (panel.Content ?? panel.transform).GetComponentInParent<ScrollRect>(true);
// Hides every list entry the viewport only partly shows, so the list ends on a whole row instead of slicing text.
private void FitViewport()