private void OpenPanel(GameObject submenuPanel) { if (startPanel.activeInHierarchy || settingsPanel.activeInHierarchy || aboutPanel.activeInHierarchy) { Debug.LogError($"Cannot open {submenuPanel.name}, since only one sub-mainmenu panel can be active at a time."); } Button startButton = GameObjectUtils.FindFirstChildWithTag <Button>(submenuPanel, "ContinueButton"); Button closeButton = GameObjectUtils.FindFirstChildWithTag <Button>(submenuPanel, "CancelButton"); if (startButton) { GameObjectUtils.AddAutoUnsubscribeOnClickListenerToButton(startButton, () => { actionOnStartPress(); }); } if (closeButton) { GameObjectUtils.AddAutoUnsubscribeOnClickListenerToButton(closeButton, () => { DeactivePanels(); actionOnPanelClose(); }); } actionOnPanelOpen(); submenuPanel.SetActive(true); }