diff --git a/Assets/Prefabs/UI.prefab b/Assets/Prefabs/UI.prefab index 3d728386..106eb9a0 100644 --- a/Assets/Prefabs/UI.prefab +++ b/Assets/Prefabs/UI.prefab @@ -689,6 +689,7 @@ MonoBehaviour: spaceAtBottom: 40 spaceBetweenButtons: 30 openedWindowTextColor: {r: 0, g: 1, b: 0, a: 1} + canvas: {fileID: 4580190521452898284} buttonsContainer: {fileID: 8593699161208457630} buttonPrefab: {fileID: 9144763033384219215, guid: c5e7e3e4ef714514090db34e6278e452, type: 3} diff --git a/Assets/Scripts/UI/MainMenu.cs b/Assets/Scripts/UI/MainMenu.cs index 455d84c4..aeacaec5 100644 --- a/Assets/Scripts/UI/MainMenu.cs +++ b/Assets/Scripts/UI/MainMenu.cs @@ -21,6 +21,7 @@ namespace SanAndreasUnity.UI static MenuEntry s_rootMenuEntry = new MenuEntry(); + public Canvas canvas; public RectTransform buttonsContainer; public GameObject buttonPrefab; @@ -36,16 +37,12 @@ namespace SanAndreasUnity.UI clickAction = () => GameManager.ExitApplication() }); } - void OnGUI () + void OnSceneChanged(SceneChangedMessage sceneChangedMessage) { - if (!GameManager.IsInStartupScene) - return; - - // draw main menu gui - - + this.canvas.enabled = GameManager.IsInStartupScene; } + public static bool DrawMenuEntry(string text) { return GUIUtils.ButtonWithCalculatedSize(text, Instance.minButtonWidth, Instance.minButtonHeight);