dont create popup prefab if it already exists

This commit is contained in:
JohnCorby 2022-08-02 12:24:18 -07:00
parent cbd02995d9
commit 9e2a6777af

View File

@ -54,9 +54,12 @@ internal class MenuManager : MonoBehaviour, IAddComponentOnStart
{
Instance = this;
_choicePopupPrefab = Instantiate(Resources.FindObjectsOfTypeAll<PopupMenu>().First(x => x.name == "TwoButton-Popup" && x.transform.parent.name == "PopupCanvas" && x.transform.parent.parent.name == "TitleMenu").gameObject);
DontDestroyOnLoad(_choicePopupPrefab);
_choicePopupPrefab.SetActive(false);
if (!_choicePopupPrefab)
{
_choicePopupPrefab = Instantiate(Resources.FindObjectsOfTypeAll<PopupMenu>().First(x => x.name == "TwoButton-Popup" && x.transform.parent.name == "PopupCanvas" && x.transform.parent.parent.name == "TitleMenu").gameObject);
DontDestroyOnLoad(_choicePopupPrefab);
_choicePopupPrefab.SetActive(false);
}
MakeTitleMenus();
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;