Skip to content

Commit

Permalink
fix some popups appearing underneath menus
Browse files Browse the repository at this point in the history
  • Loading branch information
misternebula committed Nov 10, 2023
1 parent 530195e commit 4797175
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,12 @@ public override void InitializeMenu()
_ok1Action.OnSubmitAction += InvokeOk1;
_ok2Action.OnSubmitAction += InvokeOk2;
_ok3Action.OnSubmitAction += InvokeOk3;
// PopupCanvas is disabled after the menus are initialized, and overrideSorting can only be set when it's enabled
_menuActivationRoot.gameObject.SetActive(true);
_popupCanvas = gameObject.GetAddComponent<Canvas>();
_popupCanvas.overrideSorting = true;
_popupCanvas.sortingOrder = 30000;
_menuActivationRoot.gameObject.SetActive(false);
gameObject.GetAddComponent<GraphicRaycaster>();
gameObject.GetAddComponent<CanvasGroup>();
}
Expand Down
12 changes: 12 additions & 0 deletions src/OWML.ModHelper.Menus/CustomInputs/OWMLPopupInputMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ public override void Awake()
this._inputField.DeactivateInputField();
}

public override void InitializeMenu()
{
base.InitializeMenu();

// PopupCanvas is disabled after the menus are initialized, and overrideSorting can only be set when it's enabled
_menuActivationRoot.gameObject.SetActive(true);
_popupCanvas = gameObject.GetAddComponent<Canvas>();
_popupCanvas.overrideSorting = true;
_popupCanvas.sortingOrder = 30000;
_menuActivationRoot.gameObject.SetActive(false);
}

public override Selectable GetSelectOnActivate()
{
return this._selectOnActivate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,12 @@ public override void InitializeMenu()

_ok1Action.OnSubmitAction += InvokeOk1;
_ok2Action.OnSubmitAction += InvokeOk2;
// PopupCanvas is disabled after the menus are initialized, and overrideSorting can only be set when it's enabled
_menuActivationRoot.gameObject.SetActive(true);
_popupCanvas = gameObject.GetAddComponent<Canvas>();
_popupCanvas.overrideSorting = true;
_popupCanvas.sortingOrder = 30000;
_menuActivationRoot.gameObject.SetActive(false);
gameObject.GetAddComponent<GraphicRaycaster>();
gameObject.GetAddComponent<CanvasGroup>();
}
Expand Down

0 comments on commit 4797175

Please sign in to comment.