Customising the Prefabs
Last updated
Last updated
Each of the three Menu Prefabs have the same Basic Structure. One slides the buttons in and out, one fades the buttons in and out, and the other uses Fading with text Mesh Pro. Below, we will document how each menu works and what it includes. The Save/Load ctions will be covered in the following section and here we will just highlight where it happens.
The Prefabs are also structured the same, with a single Canvas, a Panel containing all the UI Elements, a set of triggers for Actions not controlled by buttons, and a Set of Actions for each of the corresponding Buttons.
You can expand these gameobject to see the structure, and each of the menu structures are the same. However, to enable these Menus to work, the following Variables must be defined. These are included in the example project, but caremust be taken not to overwrite your existing project settings.
All Buttons used are Game Creator Buttons to allow for easy access to Actions. The naming convention is simple, for example the Start Button calls the Start Menu set of Actions. Each of the menu screens has a Back Button, which simply animatrs back to the previous screen. The First Menu screen has a Quit button, which calls the GC Action to Exit the game. The rest of the structure is as detailed below.
The Play Button displays New Game, and Saved Game Buttons. The New Game Button attempts to load a scene from a Global String Variable called New-Game-Scene. Here, you can add the name of the scene you wish to load, but it also must be in the build settings.
The Saved Game Button will display a DropDown menu, where you can select previously saved games (this is covered in more detail in the following section). When a saved game is selected, the profile that it is saved under is added to the Global Number Variable called Load-Slot and this profile is set to current. The Load Game button will then attempt to load the saved game from this Profile.
The Options Button displays Player Options, and Game Settings Buttons. The Player Options Button displays Easy, Medium and Hard Buttons. These buttons set the Difficulty-Level Number Variable to 1, 2, or 3 respectively.
The Game Settings button display a further menu with Controls, Graphics, and Sounds Buttons. The Controls Button displays three check boxes for Player Input. These check boxes set one of three Bool Variables to True. The Variables are Input-Directional, Input-Follow-Pointer, and Input-Point-and-Click. These Variables can be further used with a GC Action to set the Player Input control in the Main Scene.
The Graphics button displays a panel with a slide control. This slide control will set the Number Variable Quality-Settings which can be used with a GC Action to change the Graphics Quality.
The Sounds button displays a panel with two slides control. These slide controls will set the Number Variables Music-Volume and Sound-Volume respectively, and can be used with a GC Actions to change the Music and sound effect volumes.
Apart from the Load Saved and New Game buttons, the other menu buttons will set Game Creator Variables which can easily be used in the Main Scene, or used as they are by adding a GC Trigger for each On-Variable-Change and linking it to the corresponding Action.
For Example, a Trigger with On-Variable-Change for the Quality Settings would call the Action Application/Quality Settings, and use the Value from the Quality Settings Variable.
The same would be for the Sound Sliders, add a Trigger with On-Variable-Change for the Music Volume would call the Action Audio/Change Volume, select Music and use the Value from the Music Volume Variable.