MAIN MENU in Unity | All-In-One Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

This took me absolutely ages to put together, do let me know what you think of it - If you guys find it helpful! :)

👍︎︎ 1 👤︎︎ u/SpeedTutor 📅︎︎ Jul 08 2021 🗫︎ replies
Captions
hey guys it's matt welcome to speed tutor and this is going to be the world's best main menu tutorial that you have ever seen okay okay so it might have been a slight exaggeration because there is a lot of tutorials online to show you how to make menus but this is going to be the quintessential i'm going to try and make it the quintessential very best step-by-step guide with annotations that you'll be able to look in the timeline and i'll split it up into specific sections between being able to design all of the menu use and work with all the uis be able to open and close specific menus we're going to be able to control buttons toggles sliders we're going to update text next to sliders when we pull the slider across we're going to look at saving the preferences into player prefs then when you every time you load your game or load your menu we're going to load those preferences and then i'm going to show you how that you can customize specific ui elements in your menu i'd really love to know from everybody how long it took you to make your first main menu and if you do learn anything from this video today please let me know in the comments [Music] so just before we get started if everybody who watches this can leave a like even a comment anything like that it would really really help out the video so thank you so so much and we're going to make a main menu similar to this with the customizations with the different buttons that we can click on new game we can bring out pop out dialogues to be able to choose yes or no to be able to load a game potentially to be able to use options to change graphic settings to change the sound and audio to change gameplay to show controls an inversion controller sensitivity setting to defaults being able to go back choosing to show you each of the buttons how they work opening menus and being able to save all this data so we've got a new scene in unity and you want to get started so what do we want to do our big process we're going to go to 2d mode by clicking 2d at the top and right click in the hierarchy go ui and select canvas then we're going to go to the right hand side and go to canvas i'm going to go scale with screen height so you're going to scale this with the screen height that you want so we're going to do this as 1920 by 1080 and that is our resolution that is going to be for our menu because this is the default resolution that most screens will be on a computer you want a background for your menu to get it started so first of all we can go canvas right click ui and we're just going to choose image we're going to keep this as this image is selected click on the anchor points hold alt and in the bottom right we can click that and it will expand to the exact part of our canvas so when we click on our image we can add a screenshot or something we want in the background if you want this to be dynamic it could be part of your scene we can make sure that our image is actually a sprite 2d and ui when we click on it in the inspector go back onto our image and we can add this to the slot and now we have a background and this is just from my game left alone now we can change this to menu background as an example and now what we're going to do is right click on this canvas will go ui and we'll choose panel and this is just going to be a panel which is going to contain our actual objects that going to be our menu on the left hand side so what i'm going to do is i'm just going to call this panel the main menu container so this is going to contain the main menu that we actually have so now what we're going to do in our main menu container we can right click this choose ui and choose image so this is going to be our new image that's going to be our one on the left hand side we can drag this place it up to the top we can drag down to the bottom and we can just scale this across however we want it to physically be this is perfect and we can just call this our background underscore ui we can set this image to black we don't want it to be a rare cast target or anything like that we can change to a custom image but i'll show that towards the end you can select your panel and we just want to remove the image property from that because we just want it to be just a default property then from here we can also set and anchor its ui property to the left hand side so it's always here no matter if we scale up or down on the resolution it's always in exactly the same place then we want to create something for maybe a game logo so we can right click again choose ui and choose image you could place this object in line in the center of the object here i might just make this 250 by 250. you could set that to its anchor point in the inspector to the top left we can add an image here which is going to be my little game logo for left alone and i will just add it into the sprite slot you could create this as however you want it to be and we can rename this game logo then we want to create a series of buttons that we're going to want to do something so we can right click we can choose ui and we can choose button with text mesh pro and you can import the text mesh essentials if you would like and now we've got our button here i'm going to drag this in between both of my objects because with the way that ui is rendered we need things at the bottom which we want to show on top so the game logo always has to stay though so so what i did for my object for my menu is that this one normally has a button which you can use to highlight but i wanted to highlight the text so if we grab the text mesh pro and we just unparent that from the actual button object delete the button object go back to the text mesh pro text we can add a component to that called button so when we add that then that becomes interactive so we can go to the vertex color of our text to change that to white i'm going to make that bold and i'm going to scale up the text size a little bit more i will make sure it's all the way to the left of our object and we can leave it looking like so we can edit the text and call this new game so you can see that it's slightly too big and we can just scale the text size down until we fit into that box perfectly you can see now that my text just displays normally we can accept the normal color to just the color we have here i'm going to set my highlighted color to an orange like so i'm just going to click on the little button at the bottom to create and add a new preset so this will be the color that i can select without having to then select the wheel so i've got one that i've already set down here so it can be that color here and then i'm going to select my choose my selected color and that's also going to be the same orange so that when we go into it and press play you'll notice that my text are now acts as a button just exactly like this and the font changes like that so this is now going to be changed to new game button then what we're going to do is just duplicate what we've got here so we've got a new game button we're going to keep this in line with the other and duplicate again and then a duplicate again so what we're going to have the second one is going to be our load game button so we can rename that to load game we could scale our button very slightly make sure it's still in line change the third one to options options settings whatever you may want and the bottom one can be exit and we're going to name the buttons accordingly so you can see they all share exactly the same and now as you can see when i click on my main menu container i can just tick this on and off so this can disappear whenever i don't need to be able to interact with any of the buttons you can find this entire menu system on my patreon if you want to support the channel you can find scripts complete projects and so much on there so thank you so so so much for watching so from now we want to create a bunch of selection or dialogue options that appear so when we click one of these things you don't just want to instantly load a game or create a new game or do something you want to ask a player before you do it so then they can accidentally click and go oh no i've just i've just started a new game and i didn't mean to so what you want to do is be able to click you have a little pop out menu which can decide did you really want to start a new game or not and you click on load game did you want to load your game no then you can go back or yes and what we can do is we can collapse this main menu container right click on our canvas again choose ui and choose panel and we're going to rename this new panel to is going to be our pop out dialogue container so this is going to be something that control the things that will pop out here when we want to choose to create a new game load a new game or do something like that so we can again get rid of the image component from there we can right click on the container choose ui and then choose image and then we're going to place this in the very center of our screen i'm going to scale this up to around the size that we expect our our notification pop out to be so i will keep it roughly this size like so i'm going to change this so it's now a black background i'm going to write i'm going to select that image and rename that to new game panel dialog so we're going to be able to have options to change stuff within this then i'm going to right click that choose ui and choose text mesh pro text we're going to put that to the very center of the object we'll scale the whole thing out by selecting the very corner and centralize that again and i'm just going to rename this and write do you want to start a new game and then what we can do is we can centralize that and centralize that in the middle again you could scale it up and make it bold to change the font whatever you want to do with it and then we can rename that to our top text then what we want to do is we want to duplicate that text and we're just going to call this our new game dialogue and we'll just call this our yes button we'll drag this down to the bottom here we'll add the button component again again we want to choose the orange for selected and highlighted then we'll rename the text to yes we can scale that in slightly like so and we can just keep this somewhere around here we can even scale it up slightly more so yes and then we'll duplicate this onto the other side we'll keep in line with the other we'll rename that to no and then we'll say that new game dialog and we'll just call this the no button so now when we actually have this option visible you can see that we now have a yes and no option when this appears to whether we want to start a new game or not and then we can just untick this to hide the entire thing and what we can do which is really great is we can just duplicate that thing that we have that menu that we've just created and we can make set active and we can just call this one the load game panel dialog and then we can open that up the top text could be changed to are you show you want to load and then you can leave that as yes and no and we can just rename those to keep it consistent with everything we do load game dialogue with in each case and load game yes and no and it shares exactly the same things that we want and we can get rid of that and then we've got one last one that if we don't have anything to load we maybe want a little pop out to suggest oh we don't have anything to load so we need to go back so again we'll duplicate the load version add the pop out we're just going to call this the no save game dialog and the top text will say no save file found and we're just going to get rid of one of these buttons we're just going to leave the yes one available and we're just going to make sure that this is just an ok button that we can interact with and we'll just call this ok game so it's going to be no save dialog and we'll change this to ok button and we can pretty much hide all of these different options and of course you can adjust any of the styles scaling anything you you might want to do but now we need to control how each of these things are going to appear and then write the script to make a new game button to do something load game options so with the ui system what we can do is you can see on the new game button here at the bottom of our button component you've got a list of on the click events so what you can do is you can press plus and you can see that it's looking for something to do so when we click new game what we expect to do is we can add the main menu container because we want to turn that off when we select it to bring up our other option so we can't accidentally click on something else so we can go to there we can go to the game object and we can go sec active at the bottom and we can keep that as false so this is going to turn off when we click new game but also we need another runtime event which is going to be our new game panel dialog which we'll add we'll do the same thing we'll go to game object and we'll set the ball that one to true so i'll give you an example of this so now we've set the new game button to do something so now new game button we've highlighted it clicked it and you can see oh that's disappeared and then we can move from there we'll do the same with the load game button we'll add two events we'll add itself which is the main con main menu container set that active to false add the load game dialog and go on to game object and then set that active then we can do the last thing which is the exit button will be done in code and the options menu will be created as a separate part of this because it's not something we need to do yet but then the load game button for no new game will be used soon so we've linked those up for now so now we'll create a script to control the different things that we're going to do on our yes and no buttons and also to be able to control the exit so we'll right click create c-sharp and we're going to call this our menu controller open up in visual studio so i'm just going to get rid of the starting methods and just add some i'm going to add some headings just keep all neat we're going to use two namespaces so using unity engine dot ui and then using unity engine dot scene management because we're going to want to use use some ui components and be able to load scenes when we want to so in this case what we're going to do is write public string and then we're going to call put an underscore and we're going to say that our new game level this is going to be the thing that we might either load or run at any point when we create a new game and then we're going to have a private string called level 2 load and this is going to be something that will load our level when we need it so first of all we need to control that when we press yes on that new game dialogue public void which is going to control us and let us be able to click it in the on click event we'll call this in new game dialog yes and then we will write scene manager dot load scene and then in brackets and then our variable which was our new game level so when we click that yes button we're going to load a scene that we ask it to then another public method which is going to be control our to be able to load and we'll call this load game dialog yes so once we've written this method i will show you this more advanced when we get into all the settings but for our load game button i'll show you the basis of it at the moment so if we say that if our player prefs and we're going to use player preference to save the data dot has key so we're going to check if player press has this particular thing and then we're going to call this and give it a name of the file that we would save if we were looking to save data and i will show you how to do it we're going to look for something called saved level we're going to add two curly brackets below and then we're going to say from the variable that we created which was level to load so we'll say level to load equals playerprefs dot get string and then in quotes and in brackets we'll say saved level so we're checking at any moment that when we choose to yes we want to load a game we want to check do we have a file which is called saved level if we do we'll say that our local variable of level to load is equal to the playerpreferences.getstring from this file and then if you wanted to at any point actually create that into let's say you had a level that you wanted to push into that file you can just say player press dot set string and then you can say saved level and then you put something and then whatever your whatever your level is you can add in there and it will save it for you but this just assumes that we've already got that saved because this is our load button then what we can do is do it like at the top we can go scene manager dot load scene and we can specify that it's the level to load so this will just load that level if we want and then else is going to be something that we use and if you don't have anything available to load then i want to pop up that thing saying there is no save file available so you'll probably have to click new game so then what we can do is write serialize field below here for another variable that we're going to get our n and we're going to get our no save game dialog because this is how we're going to make it appear otherwise we're going to go private game object and have this as no saved game dialog set that equal to null like so and then in this else statement we will say that no saved game dialog dot set active is equal to true so that's how we're going to control this appearing because it'll only do it after we've pressed yes then under this method we need to control our exit button because our options button will come in the future we'll say public void exit then two curly brackets below and then we'll just say application dot quit as easy as that that's what we love something really nice and easy we can go back into unity and we can what we can do is we can just create an empty game object and we'll just call this our menu controller so we can always access it wherever we want we could add this to the canvas i'm just going to put it here so it's always available so the new game level is something we can fill in and the the no saved game dialog needs to be a game object so we can add the no game no save game dialogue into that the new level that we might want to load we'll call that level one we also need to make sure that we have another level called level one so what i could do is go file create a new scene and i'm just going to file save as so i'll save this new scene as level one in my scenes my previous scene was called sample scene so we'll name this to main main menu and then what we could do filed build settings and we'll go and add main menu as our first and level one as our second so now on our new game button you could see that everything was previously connected we can go to our new game dialog and you can see that on our new game dialog when we press yes we want to do something so again when we press yes we will add our menu controller to that we'll go on to the function choose menu controller and choose the new game yes button and i'll make this appear that on the no we want to go back to this menu so we need to hide this one and make this one behind visible so again we can add two lovely actions we can set to itself which is the new game panel dialog we'll go set active and we'll set the ball to false we'll add the main menu container and we can go to the drop down go game object set the boolean to true so our now our new game is set up and ready to go for our load game option i'll open up the entire dialogue i'll go to the yes button and then what i want to do is create an action on the button component i'll add the menu controller we'll go to the action the new controller and when we'll choose load game dialog yes then we'll go to the no button and we can do the pretty much the same as what we did before add two prompts again add itself go to go to the game object set active false add the main menu container game object set active true and then on our ok dialog we want the ok button we also that when we press ok we also want this to go away and bring this one back so again we're going to do the same thing two things and we're gonna hide itself so we'll go to the set itself to off and then want the main menu container to be visible so we'll set itself true then the last one thing we will do is we will go to our exit button and we will say that we can add another on click event we can add our menu controller we can go to the menu controller and we just can choose this as exit button so we're getting everything going so now if we test it we can see that new game all these are highlightable we could press exit and it would work if we built this out we go to new game you can see our pop out works if we press no you can see that it goes back if i press yes we'll go to our new scene because that's what we wanted to load and i will go back into play mode again if i go to load game you can see that that pops up i can press no to go back go yes there was no save file found so i can press ok and you can see that once i press that button this menu is still there we could leave that but this is the whole purpose of testing things and then what we actually may need to do is if we go into the load game button we need to make sure that that hides when we click the yes button so we had a yes so we can add another action here and choose and look at find itself the load game panel dialog do the set active and set that equal to false so now in this case we can press play load game yes no game found press ok we'll go back to that menu that we created so now we're going to look at creating our graphics menu so really this is just going to be a duplicate of what we had here so we can take our main menu container which is just this entire object we can duplicate that entire container we'll put it above our pop-outs well i'm just gonna hide my main menu container there you can see that the main menu container that i've just duplicated we can rename this to options menu container and you can see everything in here so we'll open it out and we'll still have the background the image the everything but instead of having we'll set new game we'll change the text to graphics we'll rename this to our graphics button we'll do load game which is going to be set to sound we'll change the name of our button to correspond with that we'll change our options value and we'll change this to gameplay change the name of our button i'm going to select the exit button and just put two angled brackets facing backwards and it can act as our button that goes backwards and we can just call this our back button and then in these cases if we press play you can see that we'd be able to select these as we would just like our other menu but we need to connect what they do too in on our main menu container which we had we had the options button we needed this options button on the on click to do something so again we can add two actions we can add the entire menu container as the first one we'll go to a game object we'll set active so it'll be false then we want to enable our options menu container which is everything that we want again set active and set that equal to true and you can see that when we're on our menu we can go to click options and then we've switched so again we can change our back option our back option has already the duplicate from our session from our exit button so we can just remove that we can just add another to the on click on our back button just like before but we're going to replace it so in itself we're going to add itself i'm going to say i'm going to replace the one that we had before which is a duplicate of the exit button set the game objects active so we'll turn itself off and then we're going to add the main menu back game object so active and then true so we'll be able to go back to the main menu if you want but in these graphics sound and gameplay we need pop outs to be able to control exactly what we want to do on those menus you can find this entire menu system on my patreon if you want to support the channel you can find scripts complete projects and so much on there so thank you so so so much for watching so what we can do is we can just duplicate the pop-out dialog container so this is going to be that something that's going to so we're going to act these as our individual setting pop-out container these are going to be each of the individual settings that we have so essentially we can just turn that one off for a second we can go into our individual settings and you can see that i've got three and we'll have three we'll have graphics sound [Music] basic gamepl so we're going to call this one the sound dialog menu we're going to open it up so the top text you can rename these to however you want i'm just going to call these audio settings and then we're going to keep two buttons we're going to have a back apply and a reset so in this case we're going to rename this one to our sound dialog and we're going to call this our reset button so we're just going to name this to reset to default and we'll just scale this entire thing out i'm going to turn this text size down so we've got it like this i'm just going to put this in our bottom corner then we're going to create a sound dialog back button so in this case we're just going to call this one back because we need to be able to exit this menu to go back at any point we'll scale this down slightly and we'll place them both roughly in line with each other with the reset button we can anchor it to the bottom left and with the back button we can just anchor that to the bottom middle then i'm going to duplicate the back button that we've got because this is going to be a base to all our little pop-up menus that we'll create so then we're going to do the sound dialog and then i'm just going to call this my apply button because we want to be able to apply the settings that we choose so i'll drag that across and rename that to apply so it's something we're going to be able to click if we choose to apply the object that we want now for our audio we want to control what the audio does so we could do is we can right click on this container choose ui and then we're just going to choose a slider so we'll create a slider and then what i'm going to do is i'm going to drag the corner hold shift and i'm going to scale it up slightly and i'm just going to place it in the center as this example and then what i'm going to do is i'm going to hide the handle element i'm going to select the handle slide area and push that all the way to the end here and again i'll do the same with the other side i'm going to get this the fill area and also push that all the way to the end on both sides and then i'm going to get the fill object and if you fill object doesn't play you might just need to play the game again so what we can do is we can take the left side and push that all the way in there take the right side and push it together so we almost get rid of that object that when we press play we can slide it all the way in each side back and forth what we can do is the top text is from text mesh pro so what we do is you can duplicate that and we can make that part of our slider so we can put that as above our background and we can just rename this to our volume we'll take that i'm just going to scale this in a lot and i'm just going to rename this to our volume and we can again align this with the center of our volume object what i'm going to do is duplicate that volume text bring it to this side and this is going to be the thing that will update so now instead of that being the volume text this is going to be our volume slider value so we can just keep this and now on something like 0.5 for instance and we can scale this down slightly and just keep it in the center of our object and then we can anchor all our objects so the text we can name that put that to the right we can get the entire slider object and keep that in the center and get the volume and put it to the left hand side now if we select on our actual and we'll rename this to volume slider if we rename the volume slider you can see that it's got a minimum max value to the actual slider itself what we can do is we can make sure that that's between naught and one we can set the default value to say 0.5 by default because maybe that's how high we want our volume at any one time and then what we can do is go back into our manuscript because we want to control what this does so back in our menu script i'm just going to write a new header for the volume settings that we need then i'm going to write in square brackets serialize field private text and this is the volume text value that's something that wanted to change on the right hand side set that equal to null because it's technically a text box then we're going to have square brackets again and say private slider this time and have this as our volume slider set that equal to null as well then we need to write a method which will control how this will work so below our last method about the exit button we can have a public void set volume and we can have a float call that volume as the parameter for this method and say that in this instance i'm just going to change the audio listener so this will change every single audio that we have in the game you could use audio mixers to change it but this is just a core example so we can do audio listener dot volume is equal to whatever volume we've set so audio listener is a value of norton one so if we set it to 0.5 it'll be half the volume of what it would be at any point and it will turn all our volumes down but we wanted to update the actual setting that we had so that text box on the right so what we need to do is say volume text value dot text is equal to our volume which we've set here that when we slide the slider dot to string and then in brackets in quotes we'll put 0.0 so that's a decimal place and it will allow us when we specify this value so whenever we change it we'll update that so you can see it in a way how do we then go about saving that so we can we can make it change but we want to be able to save it so when we hit our reply button here we want to do something so we'll say public void volume apply and then we'll add two brackets two kilo brackets below and say that player prefs like i mentioned before in this tutorial dot set float and then in quartz and in brackets we can say set a name of the file that we want to save so we'll call this master volume as an example then we'll put in comma then we can say that the audio listener dot volume is the thing that we might want to save because if the audio listener changes that'll be the volume that we could save but instead you could create another variable which remembers what this value is at any point if you wanted to create one yourself and that will just save a this float value into that name of the file so in any other case we might want to show a prompt of how we've saved it or if something is happening when we save it so we can just create a simple code routine to make this happen is we can write public i.e numerator and then we can call this our confirmation box and we can just say our confirmation prompt is a variable that we need to create and we'll say set active is true we'll say yield return new wait for seconds and we might want to show this for two seconds for instance and then confirmation prompt just like this above and we'll say dots active is false like so now we just need to take confirmation prompt put up at the top here we'll say that we're looking for a serialized field private game object and it will be our confirmation prompt set equal to null and then in our volume apply we can just do start core routine it open brackets and we can just call this the confirmation box two brackets any semicolon so every time we press apply we will confirm that that happens i will mention that this code is appropriate for the normal unity ui but if you're using like me as an example for text mesh pro we need to say at the top using tm pro and then it won't be a text value anymore then for this case for our text mesh part we need to change this to a variable of text mesh pro underscore text and then we can still do the same code which is the volume dot text volume text value dot text is equal to the same so we just needed to adjust this value variable for us then what we need to do is we can go back into the menu controller we can add our slider and we can add the volume slider value text that we wanted to add go to our volume slider itself add another input or an unchanged value add the menu controller drop down here select menu controller and use a dynamic float which is set volume and you can see that it was between a value of 0.1 and it starts at 0.5 so we can press play and now what we can do to check if the supply button will work is i've got asset called player press editor and utilities and it shows what our current player prefs are saved into the current player preferences so if on our apply button we just select the supply button and we need to add we can need to get rid of the two on the click events that we've currently got we need to press the plus and we'll add the menu controller again we can go to the function we can go menu controller and we can just say volume apply we need to make sure that on our menu controller we've created our confirmation prompt so if i zoom out my object slightly what we could do is on our canvas we can just right click ui and choose an image like so the image will just appear in the bottom we could just put it here we could change this if we wanted and we could just call this our confirmation image as an example go to our menu add that to our little selection here we can press play you need to make sure that you actually adjust this option here or it won't actually adjust your volume it'll be whatever default the audio listener is by default at the beginning so it would be one but we will set some defaults when we start so if we put the that at 0.8 and we hit apply we can get rid of that and you can see that in my player preference editor master volume is 0.8.37 so it's a decimal place value of 0.8 and then if you want to change the back button that we have what we're going to do is we're in this case if we've got the back button and we've changed everything you would often bring up a prompt for the player and say you might have adjusted the settings do you want to save but in this case we will just go to the bottom and what i'm going to do is get rid of the two on click events we'll have one we'll add the sound dialog menu which is there we're going to set itself to false we're going to add another which then should bring back our options menu container which was the big options container like that because that's the one we wanted to go back to and we will set that as game object to true but then we also want to do we'll add the menu controller and we'll just choose to save everything so we'll just do volume apply again because in case we've set everything we want to just make sure that we can go back and make sure we've saved everything that we've changed just so that the user doesn't find any issues we wanted to change the reset button so what should we do there what we can do here underneath here we could say serialize field private float and we'll call this our default volume and we'll set that equal to whatever you want your default volume to be so we can have 1.0 f so this is going to be what it can be whenever say we might have changed it we need to reset back to its default we can do that so what we can do is we can go behind below our volume apply and we can just create a public void and we just call this our reset button and then in brackets after the reset button we can just call this string and then we just can call this our menu type and then below here we can say that if menu type is equal to and in our case we're just going to specify a string like it suggested so i'm just going to call this if it's audio which is going to be the audio menu then we're going to do is that our audio listener dot volume is going to be equal to our default volume our volume slider dot value is going to be equal the default volume because we want to set that value back on the slider then on our volume text value dot text set that also equal to our default volume dot to string and then in quotes the 0.0 with a semicolon and then what we can do is we can do our volume apply method again just to make sure that we save it when we go back just in case we come to a problem and somebody managed to somehow break our menu and try and mess it up so we're just covering all bases so now we can go to our reset button and you can get rid of the two on click events add one of the click events add our menu controller go to the function go menu controller and we're just going to choose the rate a reset button and it needs a string so we're just going to call this audio like we wanted or like we specified now if i don't maximize on play you can see that now i can adjust the value to maybe 0.9 hit apply our little box appears in the bottom you can see that it changed up here what i can do is i can press reset so it will bring it up and it'll set it back to one i could then set it down to 0.1 press back it would take us back to the original menu and you can see that it's set back to close to 0.1 so the only thing left for us to do and open up the options menu before and we'll click on the sound button we'll go to the drop down we'll add two new on click events we'll add the options menu container which is itself and we'll set that to false then we're going to add the sound dialog menu and set that equal to true so in this case now you can see that when we click on the sound we can do that that can be 0.5 we'll go back go to options go sound and we can always reset go back change it however we need and now we've got this basic setup done we can then go and edit our graphics and gameplay as well so now we're going to be looking at creating our gameplay menu which is going to have our controller sensitivity and invert y it's going to have the same options and it will even have a controls options that we can click on to show some basic controls so what we can do is take our sound dialog menu we'll duplicate that i'm going to get rid of the old one here and we've still got one in the background and we're going to call this our gameplay dialog menu we'll open it up the top top text can be just our gameplay settings we can just scale that out if we wish put that back to the center then in this case we can keep all our buttons the same we'll put our slider up to the top and we're just going to move this up we're going to change this volume slider to our controller sensitivity slider or we'll rename that to our i'll just call that to sends slider value and then our sends text so what i'm going to do is call this controller sensitivity and what i'll do is i will just scale this down so now we've got it on a sort of double row in this case with controller sensitivity you need to do this in how you want it to realistically work because controller sensitivity or mouse sensitivity or whatever you want is to be is very dependent on the system that you're using so when i did this i was using rewired so you could set that between an integer value between one and eight as much as you want but in this you could change mouse speed whatever you may be you need to maybe look online to do it but i'm showing you the core example of how this works so for this we could put it from a start value of one because maybe the sensitivity needs to start one goes all the way to eight we can set it as a whole number we can maybe by default have our sensitivity as a value of 4. we can set our slider value just to fall because that's my what we might want by default now we can right click on our dialog menu choose ui and just choose toggle we'll pull that toggle up we're going to call this our invert y toggle and what we can do is we can scale this whole thing up a little bit i'm going to open up my toggle grab the background of the item and i'm just going to scale that up too and then i'm going to open up the check mark and also scale that to the bounds of this box too so we have a big check mark like that i'm going to get rid of the label because i don't want that there i'm going to go inside the sensitivity slider and grab the text i'm just going to duplicate that because it's text mesh pro and i'm just going to drag it up into our invert y i'm just going to pull this down here i'm just going to have it in line with my other i'm just going to call this one invert y now what i'm going to do is i'm going to pull this actually out of the box grab my actual toggle itself i might just scale the bounding in slightly i'm just going to pull this out and make sure it's in line with the rest of my objects then i can add the text back in and we can just call this invert y text we could just set this to back left just so that it's in line with our other and then we can have a box which unticks and ticks now for our invert y toggle we can just make sure that its current is on is false because we might not want that to happen quite yet then what we can do is we can just set we can take say the back button as an example we can just duplicate that put that above two and we can just call this our controls button we can put that up here too and we could just rename that to maybe controls and then i'll put two arrows maybe i'll scale this out slightly so now we have options for our controller sensitivity inverting the y and controls that we can make yeah along with the same things that we had before now we can open up our menu controller again and then we can create some variables for our volumes for our gameplay settings so on square brackets serialize field private text so we can set this to our controller sensitivity text value set that equal to null and then in square brackets private slider and we can just have this as our controller send slider set that equal to no what we can do is put another serialized field and say private integer and we can just call this our default sensitivity and we can set that equal to something like fall then what we can i'll show you the example of being able to actually put this into a variable if we need to use this another time so we can just write a public integer we can just call this main controller sensitivity we'll set that equal to 4 2 because this might be a variable that we use to access from other scripts if we need to remember that whatever it's set if we need to change it at one point like i said that you could do for the volume then we need to do something for our toggle so we'll add square brackets and then we'll just have serialized field again say private toggle and then have invert y toggle set that equal to null but again you've got to remember that we're using the text mesh pro so i need to just copy this variable here and make sure that our sensitivity text that we're going to select is a text mesh pro item now below our volume we can have another public void we can have this as set controller sensitivity and have that as a flow sensitivity with two brackets below now remember our sensitivity was actually an integer to use a dynamic on click event when we change the slider we update it it needs to be a float value it can't be an integer so we're going to have to convert from float to int to make this work so this is why i needed that variable that we created so we'll call this main controller sensitivity is equal to the math f dot round to int and then we're going to say in brackets is sensitivity that's why i set that controller slider to actually a whole number in the inspector because it's going to expect a whole number so we're going to create it into an integer for us so we can have accept it into that variable then we're going to say that our controller sensitivity text value and then once the controller sensitivity text dot value dot text is equal to the sensitivity dot two string in brackets in quartz and we're just going to have a zero and that's going to set our controller sensitivity for us and now what i want to do is we can't do it quite as easily with the toggle box to do the inversion so i'm just going to do that in the apply so we're going to be able to apply both the sensitivity and the whether we want to invert the actual object itself so we can say public void gameplay apply and then two curly brackets below and we'll say that if invert y toggle dot is on that would mean it's true so that it's currently ticked then we'll say player prefs dot second open brackets master invert y comma one so that just means that it is currently at a value of one so a boolean that when we set something true or false is a one or a zero so one is true zero is false so we can read that another time and then we'll write an else and we'll say that player prefs dot second and then we'll say that the master invert y in quotes so that's the file that we want to save it in and we'll say comma zero so that's means it's false if it's not actually true when we press apply then what we could do to save our controller sensitivity is in player press dot set float and then we can say and we can say this is a file of master sensitivity have that as common as our main controller sensitivity because that's how we wanted to save our volume because we're going to put it into that and then we can do our start core routine and we'll do our confirmation box with a semicolon and remember again like before an invert y has to be done with depends what type of controller you're using what input method you're using but in here then you could do to rever to invert the y depending on the solution that you're going to use and then not invert in this case so when you apply you save it and you do something there and so we can go back into unity we can go on to our controller sensitivity slider it's currently at set volume because it was just a duplicate of the previous thing we go to menu we can go and set it to the set controller since it gives you as a dynamic float then we can leave the invert like it was the reset we will need to create a new bit of script back can it will turn itself off it will make sure the options menu appears and in this case we don't want to be it to be volume apply we can make this the gameplay apply and then on the apply button we'll check that it does the right thing so when it applies we're going to do the menu and we're going to do the gameplay apply and then on the reset we'll go back into our script onto our reset here and then we'll say that if menu type is equal to our gameplay then below here what we can do is our controller sensitivity text value dot text is equal to our default sensitivity dot to string and we'll add the zero in quotes and brackets then we'll say our controller sensitivity slider dot value is equal to our default sensitivity then we'll say our main controller sensitivity is equal to our default sensitivity we can say the invert y toggle dot is on is then equal to false and we can choose the gameplay apply method so we're just going to do set everything to its default value and then make sure that we save that just to make sure that everything's working as it should so we'll go to our reset we'll check that it's looking for the reset button so we'll just change this to gameplay press save we we need to make sure that on our menu controller we add our controller sensitivity text so if we open up the slider we add the slider value there and then we add the actual slider itself here we can add the invert y toggle to that object slot there so now what i can do is press play and you can see that when i adjust the value it goes from a value of 8 to a value of 2. we can press y to invert we can hit apply you can see that master invert y is one master sensitivity is two we could set that all the way back we could say that's a six untick that press apply you can see that master invert y is now zero and the mass sensitivity is six if we just have those as true and we set those back to default you'll notice that the confirmation happened we've set it to false and otherwise now if say we set that to 7 and invert it and we press back it's going to save it as 1 and seven and then so in whichever way that you choose to if you choose to invert why you need to find the code to make that happen controller sensitivity you need to set however your input would work and we can set a control screen which would which you could just pop out something which is an image with the controls that are on and you can do it in exactly the same way by selecting your controls button and adding some on click events to hide this and show something else so i won't show that because it would be just retreading on old ground in our last thing that we're going to show here we can hide this object there we can go on to our options main menu here we can click on the drop down where you can go to gameplay you can see that the gameplay button has nothing we can add two things to that gameplay we can add itself which is the options menu container set that game object to turn off and we're going to set the game player dialog menu set active to true so now when we press play we can go to options we can go to gameplay we have our options there compress back and go to sound and we can do similar sort of things going to and from back and forth and we just need to look at the graphics next so now we're going to look at is the actual graphics section which is probably the most complicated of all of the sections and of course it can be more complicated if you added more settings but now what we can do is we'll duplicate our gameplay and i'm just going to make that visible and i'm going to hide my options then what we'll do is i'll go to the gameplay dialog menu i'm just going to call this graphics dialog menu and the gameplay settings can be changed to our graphics setting then what i'm going to do is i'm going to show you an example of how to do brightness so brightness in my case here it was controlled on my main camera another menu that i uploaded to my patreon it's got a brightness script which can changes the brightness between a value of between 0.5 and 2 and this is what we adjust just you can that you could possibly do this with ambient light you could do this with a shader or something which controls how light or dark maybe a post-processing but again i will show you a way to do it and then you can take this with you and be and make it as complicated as you would like i'm just going to call this the brightness sensitivity slider so this for me was between 0.5 and 1 but we don't want it to be whole numbers so not 0.5 and 1.5 and the default value should be one then we can have our brightness slider value and brightness text just to keep it consistent now what we can do is we can keep the invert y toggle which we might want and then i'm just going to move this over this side here i'm just going to call this invert y toggle i'm just going to call this my full screen toggle and for the invert y text i'll call it full screen text i'm just going to name this to full screen and we can set that to positive or negative we're going to get rid of the controls button because we don't need that anymore we can right click on our dialog menu go ui and choose drop down for text mesh pro so in this case we're going to drop the drop down down and then we're going to call this our resolution drop down i'm going to grab the brightness text duplicate that but out of my brightness slider i'm just going to call this the resolution text and change this to resolution bring that down and put that in line with my drop down box i'm going to parent that to the resolution drop down box i'm just going to bring this up above my buttons then we've got that here now we can ctrl d to duplicate that then i'm going to pull that new duplicate just below here and instead of that being the drop down we're going to call this the quality drop down now i'm just going to rename this to quality text i'm just going to name that to the quality that we will want if we select our quality drop down you can see that it has a bunch of options option a b c we're going to add another option and we're going to call this option a is going to be named to low then the second for option b is going to be medium high and ultra this is what we're going to change so if we go to edit project settings and we go to quality you can see that we have very low which we could delete low medium high we'll get rid of very high we'll keep it an ultra so we'll have fall you can add as many as you want so that is going to be our drop down that we're going to be able to set with our resolution we can well we we technically could specify all the different resolutions that we may have based on our resolution drop down but that'll be a hell of a lot of resolutions so it's easier to find it automatically based on what you might want to set so we can do this ourselves within script so now in our script what we're going to do is we want to create a few different variables to control what we're going to do so under here underneath our toggle settings i'm just going to have this and call it the graphics settings and then i'm going to do it for the brightness so the brightness should be a serialized field private slider again and we'll call this our brightness slider set that equal to null just like the rest serialize field private text mesh pro underscore text and then set that equal to our brightness text value set that equal to null so we're going to say serialize field private float and we'll call this our default brightness set that equal to one then underneath here we're going to need to store in a variable what our current quad quality level is our current brightness level is and our whether it's full screen or not so we can say private integer underscore quality level so this is going to be my variable that's holding that data i'm going to have private ball is full screen as another and then private float underscore brightness level and then we will do resolution as a separate example so now underneath our gameplay we could do we could create a method which is public void set brightness have that as float brightness and what we can do is we can say that our brightness level so the so underscore brightness level is just the data that we want to be able to start to save for later so we'll just set that equal to brightness and then i will say brightness text value dot text is equal to brightness dot to string and then in brackets in core 0.0 then below here we need to be able to save all we need to be able to set our whether it's full screen or not so public void set full screen have that as a boolean set that equal to is full screen which is our parameter and then we can say that is full screen is equal to is full screen so in some cases the brightness level we can set on demand if we wanted to we could set the full screen on demand if we wanted to but i'm going to save that to the apply button but we can also do public void this is to set the make this is set quality as another method and have that as an integer our quality index that we're going to use so in this case one set underscore quality level is equal to our quality index so like i say these are adjusting based on the actions that we do to be able to when we pull the slider do the toggle do whatever do the drop down we're going to update this variable so we can save it later when we press apply so under here we could essentially do another public void graphics apply two brackets then two color brackets below and say the player prefs dot set flow to save our brightness then we can put in brackets in quartz master brightness as the file that we'll create for comma and then we're going to have the brightness level which is that variable that we created before and then if we wanted to we could change our brightness with your post processing or whatever it is that you want to change the brightness so that's when it could be applied then player prefs dot set int is going to be in quartz master quality after the comma we'll put the quality level so this is when we can set our quality level based on the settings so in this case we can say quality settings dot set quality level in brackets and then our underscore quality level so in this case it will actually when we hit apply it will change the quality setting that we currently have to whatever index we just changed it to based on our drop down now we have all kind of can do player press dot sent can have in quartz master full screen then we can have a comma then we can have open up brackets this is technically a different way that you can save a boolean value it's a slightly shorter way we can say that is full screen so that's our variable that we saved whether it was a true or false one or not we can have a question mark to compare whether it's one colon zero i'm gonna add a semicolon on the end that saves with it's a true or false one or zero and then we can say screen dot full screen equals underscore is full screen and then again we can do our start core routine and then we can choose our confirmation box so when we apply the graphics we're going to be able to save what boolean it is we'll set it we'll save the quality we'll set it and we'll save the brightness and if we had a way to do that you can find this entire menu system on my patreon if you want to support the channel you can find scripts complete projects and so much on there so thank you so so so much for watching what we're going to do is we want to be able to get the amount of resolutions that we had so getting to resolution is a lot more complicated than what we've done for previous items so what we can do under here underneath our last variable i'm just going to call this our resolutions drop down and i'm just going to create a couple or variables so i'm going to set a public drop down so we need to reference our actual drop down and it's going to be our resolution drop down object so we're going to have private resolution and we're going to have this as an array and we're going to call this resolutions now what we need to do is we can do this below here that's just where we keep everything together so it's going to be on void start so we'll do this on the start we need to find all the resolutions that we need so we can do is we can say that resolutions is equal to screen dot resolutions first of all set resolutions screen resolutions that we have we're going to say that resolution drop down dot clear options because we need to get rid of whatever's in our current drop down at the moment because it had some values that were set there by default we don't want that anymore so we can get rid of those so we want to create a new list which will list all the different types of strings or the different names that we're going to have so we'll say list string and we'll set this as set this to a name of options we'll set that equal to a new list as a string and we'll just have two brackets a semicolon want to create a local variable for in the current resolution index we'll set that equal to zero because we need to actually be able to get the index of any particular resolution because we'll have a list of a load we can't just specify by name so we need to search through the length of our array to find to find how many different resolutions that we have so we'll say fall and then when i press double tab i get a basic for loop so i can say for int i equals zero and if i is less than our resolutions.length and then we can say i plus plus and then inside our curly brackets we can say that string and option is that a local variable we're just going to create for now is equal to our resolutions with a lowercase square brackets i dot wait plus then we can add a coil we can put an x and we can space that out so we're just going to say that the resolution should be the resolution that we found the width of the resolution plus and we're just putting an x as a string value and then we're going to say that the resolutions in square brackets i dot height make sure we have a plus after that so we can keep this string together so it's going to be the width string the height string with that in between then we'll say options dot add and then we'll add this just option which was that local variable you just created and then under here we'll say that if resolutions in square brackets i dot width is equal to screen dot when and and resolutions dot in square brackets i height is equal to the screen dot height then under here we're just going to say that our current resolution index equals to so it just means that we're going to get all the resolutions we're going to clear the options we'll create a list of options that we'll currently have we'll be able to search through the length of the array we'll be able to put into a string the width and the height of those we're going to check to see if the resolutions that we found is equal to our screen width or height and then we'll set that to our current resolution that we want to choose so that does it on start to find everything and place them into that box and get it ready for us to use and then underneath our last set of brackets underneath the for loop our resolution drop down dot add options open brackets and then it's going to be the options that we want to display then we're going to set our resolution drop down dot value is equal to the current resolution index we also want to say resolution drop down dot refresh shown value which is another method that we need to call you need to make sure that your drop down is text mesh pro underscore drop down is actually set the resolution based on that drop down so we need to write a public point set resolution and then in brackets we're going to say int resolution index then we'll have two curly brackets below that and say that resolution with a capital and then we'll have resolution which is lowercase so this is just going to be our local variable for the resolution that we want and that's going to be equal to our resolutions that we found but we want to specify the resolution index from this parameter so we'll look for based on all the resolutions that we found but we're going to put the parameter into there which will be the value that we've selected to find which is the one that we want to put on then what we want to do is say screen dot set resolution in brackets resolution because this is our local variable dot width comma resolution dot height comma screen dot full screen in this case just to make sure that these are the three parameters that it requires and now what we want to do is go to our menu controller we want to add our brightness slider our brightness text which is in this box we can go to our apply button and make sure that it's got the menu controller on and we can choose the graphics appliance but i've spelt that method wrong but that doesn't matter we can go to the back button which turns itself off turns the menu options on and we can also do the graphics apply then what we could do is go to our menu controller add our resolution drop down so then what we need to do is select our quality drop down make sure that we add an unchanged event add the menu controller here go to the menu controller and choose set quality we can choose the resolution and make sure that we have the menu controller and we change that we set that to set resolution for the full screen toggle we need to add a click event add the menu controller do the function menu controller and we can choose set full screen for the brightness slider we just need to make sure it's got menu controller and you add set brightness from the dynamics at the top as well now if i don't maximize the play and let's we test this out then we can see if that we set the object so the quality to ultra we're going to cause it full screen and we're going to set our brightness to 1.5 when we hit apply you can see that down here master brightness is 1.5 our master quality which it starts at zero for low medium and high and then it's one so it is true and now what i want to do is be able to reset the actual values that we've got for the graphics option so we need to go back up to the top and go to where our graphics settings were below here what i'm going to do i'm going to do a serialized field private and then i'm going to do the text message pro underscore drop down as our quality drop down because we want to reset that and then a square bracket serialize field private full screen toggle like so but make sure that's set as toggle then we can keep everything like this for now we can go down to our method which is our reset button we can have an if statement here which says that if the menu type is equal to we'll say graphics at this point then we'll have two curly brackets below and say that this is where we could potentially reset the uh the brightness value on the actual object or the thing that would change it but in to change the slider we'll just do the brightness slider dot value equals the default brightness then we will do the brightness text value dot text is equal to the default brightness dot 2 string and then in brackets quote 0.0 with the same column then we want to do our quality settings so we'll say that the quality drop down dot value is equal to 1 so it when not one so it went not one two three so one was medium so it'd be our second option so that's probably where we want to be if we want to reset it to default but you can choose you can set that to whatever you want then we can set quality settings dot set quality level open brackets and then i'll do the same thing we'll set that to one as well then we'll say that full screen toggle dot is on is equal to false and we'll also say our screen dot full screen is equal to false as well because that's just going to change our variable that's going to change what our object displays in our ui we'll change the actual screen and now we want to be able to reset our resolution if we've actually changed it to something we didn't want so we're going to set as a local variable resolution we'll set this as a name of current resolution set that equal to screen dot current resolution with a semicolon and then we'll say that screen dot set resolution open brackets is the current resolution.width comma currentresolution.height comma screen dot full screen with a semicolon but we also then need to set what our box should display our drop down should display so we can say resolution drop down dot value equals the resolutions dot length at the end we can just put graphics apply i mean i did spell that wrong so i'm just leaving it like that for now but remember that the resolution.value is we'd imagine that the default resolution for our current screen should be the last resolution in every resolution we get so say my my monitor is a maximum resolution of 1920x1080 that would be the maximum length or the final value in our array so that's what we're going to set our drop down to we can go to the reset to default button it's got the menu controller on it as an on click and we can just change this to graphics and we can save that we'll make sure we go to our menu controller and realize that we need the quality drop down and we need the full screen toggle these won't actually change unless we build out the game so this is something that we would have to do so you can see that my default resolution i built the game out in a wind little windowed mode and you can see that my resolution is set to i can set it to ultra i'll set my resolution down to 1200 and i'll put full screen and i'll press apply you can see it like so now if i reset to default you can see it reset to medium unticked full screen and reset to my highest resolution that my monitor can go so the last thing that we need to do is go to our options menu go to graphics and make sure that options menu is disabled and then we can change this from the new game panel to our graphics dialog menu which should be gameobject and select it true then i'm going to get rid of the graphics panel there going to close it all up i'm going to make sure that i enable my first main menu so i'll press play now we've got the new game which you can choose to start in your game if we wish we've got load game which if we had something saved we could do that we can press no we can exit if we wanted to we can go to options we can go to graphics we can press back we can go to sound we can adjust that gameplay just in versions if we want to go back change different options for graphics quality saved gameplay and be able to throw those into an initialization phase so as soon as you load your menu we need to load all those settings or when we load our game you need to load those settings that you you might want to use them at some point we're going to right click we're going to go create c-sharp and we're going to call this load prefs we're going to create a new object empty game object and we're just going to call this loadpress2 we're going to add our script there we'll open up in visual studio we're going to create a bunch of variables which are going to reference all the things that we previously had so to make this easier for everybody i'm just going to i've just created some subheadings to make it easier so the general settings that i'm going to have so square brackets serialize field private pool can use and i'm going to set that equal to false because this is where we're going to be able to say a tick box to whether we should load or not load preferences so i'm going to have another square bracket serialize field and say private menu controller so the script which is the menu controller which we wanted to access and then have this as a name of menu controller we need to add at the top using unity engine dot ui then in the volume settings we're going to have like before square brackets serialize field we're going to have private and then in our case up here we're going to also need using tmp pro and we're going to give this so this is going to be private text mesh pro underscore tech volume text value set that equal to null then we're going to have another square brackets serialize field private slider and have that as our volume slider set that equal to null as well with the brightness we can go into this script and just pretty much copy our variables that we created so the slider and the text value will paste in here so we'll do the same for the quality drop down that we wanted so the quality drop down can be here same for the full screen we'll grab the controller sensitivity and the invert y toggle just here so now we're going to put this on awake so avoid awake so this runs before any other method in the game before our start method any method this will run before everything else so it's good to use it for initialization so now we can say if can use is true then we'll have two curly brackets below so for any point that we can tick this as soon as we before we start just to make sure that if we need for debugging purposes we don't want to load prefs we can do that but now to check whether we have something we actually have something saved what we can do is we can say that if player prefs dot has key we can start by doing the volume so remember what we created before if has key and it was master volume so if that file is available then we should be able to load that file and do something with it so we're going to write a float and call this our local volume set that equal to our playerprefs.getfloat so this allows us to get the float from the master volume and if you do need to check any of the names you can check in your script look for what you originally to apply so you master volume so you make sure that you copy that correctly into here if you need it then what we can do is seeing as though we've saved so we've got the volume into a local variable which we can use now so in this case we can say volume text value dot text is equal to our local volume dot tostring and in brackets in core 0.0 like we pretty much did here so in this case we also need to do volume slider dot value is equal to the local volume and the audio listener dot volume is equal to our local volume so it's pretty much the same thing but in this instance we're just checking to see if we have saved something and if we have we will do something if not what we could do is to make sure that nothing is the issue thereafter we can have an else statement and say that if that's not the case we can just say menu controller dot reset button and we can just put and remember the reset button we had to pass in a parameter and we can just call it audio so we'll just set it to the defaults just in case that there was there was some discrepancy somewhere we'll stay inside the can use but in this instance we're going to say the if player prefs dot has key and then in quotes we'll say master quality then we'll have two curly brackets below and say integer local quality because it was going to be just an integer value set that equal to player prefs dot get int open brackets in quotes the master quality with a semicolon so now what we can do is say quality drop down dot value is equal to our local quality of what we've loaded and then the quality settings dot set quality level in brackets is the local quality so the one that we'd saved and again you could write an else statement to say that we can reset the graphics if any of that issue arose now under here we could say that if player prefs dot has key and then we can say master full screen but we might need to check that we've spelt it correctly so we'll check we'll grab that from over there and if we have that file we can do integer local fullscreen is equal to playerprefs.getint and in brackets in quartz master fullscreen just from here of course you could make these specific strings into variables which you could affect in the in the inspector then in this case we can actually say if local full screen is equal to one so it would be true we can say that screen dot full screen is equal to true and our full screen toggle dot is on is also equal to true then we can have an else statement which again we can copy these two lines and specify if it's not it must be false so they're both equal to false so we're just running through everything that we've just done and being able to load those straight into those buttons and those text boxes to be able to make sure that they are equal to the things that we want and now i've pasted this in to make it easier to and quicker for you to see so now we're saying if has key is master brightness we've got a local brightness we're getting the flow of master brightness putting in the text box and the sl the slider value and then here we also would want to change change the brightness of the actual game with however we want to do that and again i have another check to see if we've got the master sensitivity if we have we can load the flow and the controller sensitivity text.text is equal to the local sensitivity then the value is equal to the local sensitivity and then the actual main controller sensitivity is the local sensitivity rounded to an int and the very last thing to check that you could check is the if you've inverted your mouse and you can say that if the get integer is equal to one it would be true and then otherwise it would be false so now we've got this nicely written out we can go back into unity so we need to link everything up here so we can add the menu controller which is just the menu controller game object and link everything up based on what we've done previously so you can just go into your individual settings pop-outs and just add everything that you need so now i've linked everything up we can make sure that can use is ticked and you can see my player preferences down here that my current my master volume would be 0.8 my invert y is one so it was true my sensitivity was six the brightness was 1.3 the quality was a setting three it was in full screen mode so now when we press play we can go to options graphics you can see it's 1.3 it was full screen it was on setting 3 which was ultra compressed back got a sound it was 0.8 like we suggested and controller sensitivity was 6 and it was invert y so what i did is i added in my own font which was something called railway regular which you can get any fonts from online or your computer itself as you can see down here i created a couple of sprites one which is a boxy sprite and one which is a long sprite which will replace what i've currently got in mine which these were just created in photoshop are very specific sizes so this was 512 by 1080 and this one of 2048 by 2048 and i've just got them with a transparent background so if we want to be able to use a different font with stuff with text mesh pro we want to go to window text mesh pro on asset creator drag our text in there we can keep everything by default say generate alpha then we can just save as and we can just grab our button and then just replace our font in here so then we've got a new brand new style so what else we can do is the background ui which is the backdrop to this we can just add my long decayed option here and you can see that there i can just scale that out slightly and say we want to make a button sound that when we click on an object it will actually do something so on on our on click event that we might want to click and make a sound effect so we can add another click event i've just got here which is a metallic click sound i can just drag that sound into my hierarchy over here and it'll say ui click metallic so i don't want to play on a way because i only want that to play when i want it and i go to my new game button and i drag that audio source into that slot i can just do that audio source and i can just choose play so when we click that button it will make a sound and we could do that for every single button we want you'll be able to add different events different clicks you might be able to just hear when i click i got a click sound and we can go between our options and do whatever we need and be sure to comment if you think you can improve on certain parts and we can share it with the community so we can make things better and better and better you'll be able to get this entire project on my patreon i'll upload this new version with some of the new features which are newer than what is currently on there and you can check that out come and join me on discord if you want to chat check out my awesome assets on the unity store and thank you so so so much for watching so thank you and don't forget to like comment subscribe cheers
Info
Channel: SpeedTutor
Views: 16,342
Rating: undefined out of 5
Keywords: how to make a main menu in unity, unity main menu tutorial, unity main menu 2d, main menu unity, unity settings menu, graphics settings unity, unity resolution tutorial, unity quality settings menu, brackeys start menu tutorial, main menu beginner unity 2021, unity 2021, unity main menu, main menu in unity, how to create menu in unity, unity gui, brackeys menu c#, brackeys pause menu, beginner unity tutorial, unity tutorial, main menu unity 3d, main menu brackeys
Id: Cq_Nnw_LwnI
Channel Id: undefined
Length: 84min 21sec (5061 seconds)
Published: Thu Jul 08 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.