In this beginner-friendly Unity 2022 tutorial, I will teach you how to make your own amazing main menu in 15 minutes using Unity and C# Like and Subscribe, it's free and helps the channel a lot!
Пікірлер: 252
@ZyzzTheCyberous8 ай бұрын
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class MainMenu : MonoBehaviour { //Load Scene public void Play() { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); } //Quit Game public void Quit() { Application.Quit(); Debug.Log("The Player has Quit the game"); } }
@stormyRust11 ай бұрын
1 year later and your videos are still inspiring people to start developing, great work in this video. Thanks so much for explaining everything for a beginner's ears!
@garrettdeveloper11 ай бұрын
I'm so glad these videos help! I still want to keep making tutorials, I'm working on some more! Thanks for making my day :)
@heyitstoni Жыл бұрын
love how cohesive this is, your calm voice is also a nice change from the loud and exaggerated coders i've seen making tutorials
@garrettdeveloper Жыл бұрын
Thanks a bunch! Comments like yours remind me to make more tutorials :)
@nikisos65502 жыл бұрын
With that well explained step-by-step tutorial I believe I would be able to follow and make the main menu work nicely.
@garrettdeveloper2 жыл бұрын
Thanks! I try to explain everything best as I can :)
@Sadboy13923 Жыл бұрын
I was so confused with other tutorials thx so much! ❤
@WishDog_7 ай бұрын
One of the best main menu tutorials ive ever seen
@mr.munkey9205 Жыл бұрын
Your a god ur oculus vid helped me so much havent been able to play for a year and u fixed the problem thank you
@garrettdeveloper Жыл бұрын
No problem, I'm glad it helped!
@pansufurki1024 Жыл бұрын
Fantastic, this way explained is making a gamevelopment easy for everyone! Thank you for this tutorial
@garrettdeveloper Жыл бұрын
I'm very glad it helps!
@elfanneri8851 Жыл бұрын
u r underrated man best main menu tutorial I've seen
@yahya-zr1yw Жыл бұрын
for anyone who want the script realQuick here we go : using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class Buttons : MonoBehaviour { //Load Scene public void Play() { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); } //Quit Game public void Quit() { Application.Quit(); Debug.Log("Player Said I quit"); } } just promise me that you learned something from this video.
@garrettdeveloper Жыл бұрын
I appreciate you helping out! I usually don't put scripts in descriptions because I teach what it's doing along the way, but if it helps some to check for errors, I could see use in that :)
@ClownVR Жыл бұрын
on the public class Buttons : MonoBehaviour on buttons write youre own sript name
@yahya-zr1yw Жыл бұрын
@@ClownVR tnx i will later
@yahya-zr1yw Жыл бұрын
@@garrettdeveloper actually you shouldn't share the script in the comments section but if the tutorial is so long ur allowed to share the script to allow the the viewer to keep up with the tutorial ❤
@yahya-zr1yw Жыл бұрын
@@robbyz512 ofc
@waterdragontrigger2673 Жыл бұрын
Man this helped so much!!! Thank you Lad!
@garrettdeveloper Жыл бұрын
I'm glad I could help out!
@egerttiido2 ай бұрын
This was super helpful and im so thankful that u explain everything so well!
@mantaran Жыл бұрын
thank you it is better video than rest of the youtube main menu videos
@beefytime13745 ай бұрын
My favorite main menu tutorial on youtube right now!
@garrettdeveloper5 ай бұрын
Thanks so much!
@hahabar4ik2 ай бұрын
Thank you for being there. You stil help people!
@garrettdeveloper2 ай бұрын
I'm super glad this video is still helping you out. I'll be making more :)
@LuisTheCesarSpriteGuy2 ай бұрын
Thank you so much for making this tutorial, I really needed it :D
@garrettdeveloper2 ай бұрын
I'm really glad it helps!
@canwegetto1ksubswithnovide421 Жыл бұрын
I Just Needed That! Thanks
@WayForwardKalius6 ай бұрын
I'm vibing to the song (first song), i needed that tutorial for one of my unity games
@iz_drakezАй бұрын
im half way done with this tutorial and this is my first game that works and also thx this is really easy!
@garrettdeveloperАй бұрын
Youre welcome :D
@sparkdemon11157 ай бұрын
Finally, a tutorial that works for me and lets me have a main menu for my Lethal Company inspired game
@garrettdeveloper7 ай бұрын
Lethal Company is so fun! Hope your project goes well and thanks
@JanettLag2 ай бұрын
all the other videos are 25 or 30 minutes long this is only 15 and still works great! This is really easy to understand
@garrettdeveloper2 ай бұрын
Thanks! :)
@cupofnoodles3247 Жыл бұрын
this is my go to way to make a main menu i have it in muscle memory by now
@CheesySheep170622 күн бұрын
Thank you so much man
@no1ishere-t6o11 ай бұрын
I am making a game and this helped me so much thank u
@_lxvi Жыл бұрын
Thank you so much!
@Mr_sibo828 Жыл бұрын
thanks alot this tutorial is very helpful
@BEHELDJAM-bf4gj4 ай бұрын
Thank you so much this help a LOT thank you so so SO much
@garrettdeveloper4 ай бұрын
I'm glad it helped!
@AAKASHplays-wq6vr2 ай бұрын
Thanks bro i am new to game development and your video help me a lot
@garrettdeveloper2 ай бұрын
That's great! I love to see people getting into gamedev. Keep it up you got this
@ssrkrsov549110 ай бұрын
thank you my man
@JohnDoe-il2pg Жыл бұрын
Thanks for the helpfull tutorial.
@OneEyedGamerChannel Жыл бұрын
Thx for an easy to follow tutorial! :D
@garrettdeveloper Жыл бұрын
I'm glad it helped. Also you've got a cool channel, I like your content!
@OneEyedGamerChannel Жыл бұрын
@@garrettdeveloper thx dude! Been inactive for way to long but want to make GameDevposts :) will feature things you taught me ^_^
@garrettdeveloper Жыл бұрын
@One eyed Gamer Haha the same thing happened to me, and it's hard to get back to posting! I used to make gaming content and want to get back into it. I saw some of your videos and you deserve way more attention out there! If you ever want to talk or need help with anything gamdev or YT related, we should chat!
@OneEyedGamerChannel Жыл бұрын
@@garrettdeveloper thank you for the kind words! Would love to exchange ideas and experience :)
@garrettdeveloper Жыл бұрын
@@OneEyedGamerChannel Same here! The only issue is YT won't let me send my account through comments :(
@quentin.abs9994 ай бұрын
great tutorial!
@Acirazusa6 ай бұрын
nice tutorial very informative!
@lefoudegaming1233 Жыл бұрын
This tutorial is PERFECT !
@garrettdeveloper Жыл бұрын
Thank you soo much! I'm making more Unity tutorials right now by the way ;)
@ciaranscl Жыл бұрын
Thank you so much!!!!!!!!
@Cloudation1 Жыл бұрын
Very helpful, Thankyou!
@garrettdeveloper Жыл бұрын
I'm super glad it helped!
@jaimeclune38887 ай бұрын
worked for me thanks
@Mordecai_Fitness8 ай бұрын
Thank you brackeys one was outdated
@BloopMain11 ай бұрын
Great Tutorial!
@garrettdeveloper11 ай бұрын
I'm glad it helped!
@no.7992 Жыл бұрын
So so so so so much thank u man
@garrettdeveloper Жыл бұрын
No problem I'm glad it helped! I'm making more tutorials too ;)
@euwness2 ай бұрын
Thx bro its perfect video 10/10
@garrettdeveloper2 ай бұрын
Ay thanks! I'm glad it helps :)
@trijanshakya13242 ай бұрын
hey help needed! when my game started to play, the lightings of it were dark how can I fix it?
@GreiTesst4 күн бұрын
Thank you
@seranganalambaka73542 ай бұрын
thanks so much
@garrettdeveloper2 ай бұрын
You're welcome
@masgarch Жыл бұрын
Thanks! this help a lot for beginner like me.
@DukeandJohn2 жыл бұрын
When i finished the code it said I had a error c1513 on 10,6 but I love the tutorial
@gl1ndy2 ай бұрын
thank bro
@milomug3915 Жыл бұрын
Hey so... What do I do if the opacity thing doesn'y work? (4:07)
@isuspep Жыл бұрын
My Game and main menu start at the same time and if i'm not quick enough the character falls off the screen and dies(i'm making a flappy bird clone) which breaks everything. any idea on how to fix it?
@Edi_plays_horror_games3 ай бұрын
Wenn i write the code this comes out: Can't add script component 'MainMenu' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match
@x2brxo4 ай бұрын
full script: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class Buttons : MonoBehaviour -(Note make *Buttons* to what your script name is) { //Load Scene public void Play() { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); } //Quit Game public void Quit() { Application.Quit(); Debug.Log("player has exited the game); } }
@crimson7972 ай бұрын
everyhting works fine but for some reason when I load into the actual game scene through the start menu screen thing, the lighting of the actual scene get put of and colours and looks weird and it does not change back to normal, how do I fix this?
@Carlos_solraC Жыл бұрын
I did Eberything EXACLY right also te 'public void' part but i still can see play() and quit() im also not on debug mode please help me
@HKGaming-qy7bk Жыл бұрын
Main menu is easy after watching this video for me
@goopy_VR19 күн бұрын
How do I make a button to reopen the menu? Do I just duplicate the script but instead of plus one I do minus one?
@anamnesis972 Жыл бұрын
Ty so much, I've looked multiples tutorials on that and maybe I'm stupid but I didn't understood, but thanks to your tutorial I finally understood what was bugging me, thanks you~ Btw, At 10:51 It don't show Play or Quit for me, and I can't put the script on the mainmenu item in the hierachy, I have to create a new script and copy paste the code in it, would it be the reason why it don't show ? Thanks you
@McCrazyDude950 Жыл бұрын
i found a solution, just delete the entiety of line 18, so it looks like this: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class MainMenu : MonoBehaviour { // Load Scene public void play() { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); } // Quit Game public void Quit() { Application.Quit(); } }
@anamnesis972 Жыл бұрын
@@McCrazyDude950 Thanks you very much !
@STOPSYPHER6 ай бұрын
@@McCrazyDude950 still didn’t help whatsoever. I’ve wasted the past seven hours trying to figure this BS out. Same problem from every tutorial.
@verbinski31955 ай бұрын
@@STOPSYPHER I found a fix, you just have to add an empty object to the scene and referenced it from the button with the OnClick() function and it will work
@mr.sarbee6088 Жыл бұрын
why i only see the mono script in the function area?I have rewatched and rewrite everything and still the same please help
@zientdeveero6908 Жыл бұрын
Is there a reason that you made the options menu its own canvas to be turned on and off in the main menu screen and not a separate scene? I would guess for not having to load a new scene but im just curious
@garrettdeveloper Жыл бұрын
Yep, loading a scene for each screen could work but using gameobjects is better for performance :)
@PiggyPro10113 ай бұрын
I've used this same tutorial for 4 of my games (mainly because I can't keep motivation for finishing them) and it's my favorite unity tutorial.
@garrettdeveloper3 ай бұрын
I am so happy to hear that! I'll make an updated one as soon as I can :)
@PiggyPro10113 ай бұрын
I don't know why but now whenever I press play it says "Scene with build Index: 1 couldn't be loaded because it has not been added to the build settings" I'm currently unsure of what to do any recommendations will help!
@garrettdeveloper3 ай бұрын
Hey, watch the beginning where I show how to go into your project settings and build settings and add your scenes to the build index. That should fix it!
@PiggyPro10113 ай бұрын
Thanks! Your suggestion was correct I just forgot to do that part
@billywilson41212 ай бұрын
When im typing the code in, above the first section player void it says '0 refernces, and the same for the others?
@poloza-nq7nh4 ай бұрын
i wrote the script exactly the same but it says there are compiler errors and also the play and quit functions doesnt show up in the place where we set up events when clicked
@PikaAndChurro2 жыл бұрын
I was just looking to see if unity would be cool to make game ideas in the back of my head
@PikaAndChurro2 жыл бұрын
Step 1 have money
@garrettdeveloper2 жыл бұрын
@@PikaAndChurro Unity is free! lol I bet you could do it
@CheesySheep170622 күн бұрын
Btw when i add the main menu to my buttons that option dose not pop up how can i fix it?
@greocan9910 Жыл бұрын
I'm trying to follow the tutorial, but for some reason my button's fields are different. Instead of just having an empty list under On Click, mine has something called Persistent Calls and under that I have Calls which then has the empty list. When I tried to add the choice I'm given don't match the tutorial. I made sure that I add Button - TextMeshPro. Did Unity change anything? I'm using Unity 2021.3.13f1
@greocan9910 Жыл бұрын
After a little while I found my problem. My Inspector was still set to debug when it needed to be in normal. Once I changed it to normal I was able to follow the rest of the tutorial.
@Hepy01 Жыл бұрын
@@greocan9910 how do i do this
@STOPSYPHER6 ай бұрын
@@greocan9910 mine has been on normal since the start and I still have the same problem.
@STOPSYPHER6 ай бұрын
@@Hepy01 click the three dots to the right of the “inspector” tab.
@yellow_fate5754 Жыл бұрын
I swear ong you a G
@garrettdeveloper Жыл бұрын
Glad I could help!
@WilRhy Жыл бұрын
It doesn't allow me to put the script on the empty. Please help! It might be because I made the project 3D and not 2D but hopefully that's not the reason. Edit: I found this out don't worry I looked at the script and I fixed it!
@AidenUPVR Жыл бұрын
Hey, thank you for the tutorial! I have a Player Movement script that also locks my cursor when I'm in the game. How could I only apply that script when I load into the level?
@garrettdeveloper Жыл бұрын
Thanks!You could disable the lock cursor functions in the player movement script if you want the menu to do it, or just use the player movement script to lock the cursor in sync with the menu script
@AidenUPVR Жыл бұрын
@@garrettdeveloper I tweaked with some lines in the script I used where it said what lock state it was in to where if I pressed a key ( The space bar ), It would unlock and allow the player to move along. The script works perfectly fine, however; whenever I click play, it loads me into the game, but the graphics for the objects are gone. They are replaced with a solid black color. Any idea on how to fix this issue?
@garrettdeveloper Жыл бұрын
Yep, it sounds like the lighting is causing problems. Go to window>rendering>lighting and disable baked lighting and clear the cache, then if you have real-time lighting setup it should be better!
@AidenUPVR Жыл бұрын
@@garrettdeveloper Alright, thank you so much! If I have anymore problems I’ll ask.
@AidenUPVR Жыл бұрын
And I also don’t have real-time lighting.
@fosal1672 ай бұрын
veryyy good
@Dogeplayingames Жыл бұрын
thanks i made scary bean game have titel
@blabolik Жыл бұрын
it just gave me compiler errors thank you
@Zein-X2 ай бұрын
Need Help Because The Thing "On Click" I Do Like You But Like When I Go To The "StartMenu" Thing It Dont Show Me "Play ()" "Quit ()"
@worldtrending24.76 Жыл бұрын
ido all the thing and its working but it return like idont do any thing in the scean why
@GymBroskie Жыл бұрын
im really confused because when i create the MainMenu script and i try to add it to the main menu to play and quit it says (The associated script can not be loaded. Please fix any compile errors and assign a valid script) do you know what my issue could be?
@garrettdeveloper Жыл бұрын
Yes, your script has an error in the console that needs to be fixed, it's probably something small but it needs to have 0 errors before you assign it!
@F11290 Жыл бұрын
I've copied the script exactly and I still can't find the play() or quit() functions
@garrettdeveloper Жыл бұрын
Make sure they're public in the script, and that you drag an empty game object with the script attached to the onclickevent field in your button!
@landenbricks2009 Жыл бұрын
I dont see the play() or quit() when I try to select a function. I know its the correct script because I copied it word for word. Ive looked up other tutorials but they dont work either. Any ideas?
@DarkStation420 Жыл бұрын
same
@STOPSYPHER6 ай бұрын
same here.
@_jexool_GD_6 ай бұрын
Did you put public before void Play() and Void Quit()?
@STOPSYPHER6 ай бұрын
@@_jexool_GD_ yep.
@a_dam096 ай бұрын
Drag the MainMenu GAME OBJECT not the script
@SOS_Studios Жыл бұрын
how do i make it so it fades to black when pressing play?
@andmoon1449 Жыл бұрын
very very useful for me,thanks
@garrettdeveloper Жыл бұрын
I'm so glad it could help. I had trouble finding good tutorials for a main menu when I started gamedev, so it's great you could learn from it!
@David064586 ай бұрын
how do i make the acutal settings for the game?
@TRR5233 ай бұрын
My Scene won't open when I press play although the Quit button works
@DarkStation420 Жыл бұрын
I cant figure out why but it doesnt show up with Play() or Quit()
@Dogeplayingames Жыл бұрын
its says Assets\Scenes\scrpits\MainMenu>cs (18,46): error cs1002: ; expected what do i do?
@Velositygt3 ай бұрын
when i click on no function to change it it dosnt show play for some reason someone pls help
@jeremiahgamemaster9303 ай бұрын
this did not help some things work but after i started running it everything wasn't perfect the play button wasn't working
@billygaming27515 ай бұрын
it does not let me select MainMenu Script for funtion
@T_Gamer211 ай бұрын
This is Good Tutorial but you can Leave Script link?
@Cs7ano Жыл бұрын
Idk if im stupid or not bc nobody else is having this issue but im failing to find out where you got to the background section 2:32
@garrettdeveloper Жыл бұрын
Hi, sorry it might've been hard to follow, on the panel it should have a button named background for the canvas, you can either double click it or click the dot next to it :)
@cheezsteak1217 Жыл бұрын
Whenever I go into my next scene, it gets darker than darker than the original scene. Is there anyway to fix this problem?
@orbit-xenoz3 ай бұрын
i have the same problem , have you found any solutions for that?
@BMC_Logic Жыл бұрын
Assets\Script\MainMenu.cs(10,62): error CS1061: 'Scene' does not contain a definition for 'BuildIndex' and no accessible extension method 'BuildIndex' accepting a first argument of type 'Scene' could be found (are you missing a using directive or an assembly reference?) what does this mean
@garrettdeveloper Жыл бұрын
Hi! Make sure you have using Unity.SceneManagement; on the top of your script where all of the "using" lines are located.
@_Pollard_ Жыл бұрын
i kept getting compiling errors with the main menu code? help?!
@rameensheikh285010 ай бұрын
i have a problem mine screen stays zoom i cant zoom it out though i use alt and right click , thats why im unable see the whole view
@garrettdeveloper10 ай бұрын
Hi You can go to the top left of the game view and set the zoom and resolution!
@monkevr3237 ай бұрын
can you give us the script for the menu thing so we can copy and paste it?
@FreshDyl27 Жыл бұрын
When I’m trying to add a function(under on click) and go to the menu tab the 2 options don’t show up. How can I fix this? 10:42
@garrettdeveloper Жыл бұрын
Hello, some reasons they aren't showing up could be that you don't have both of the functions public. They should both be "public void". Also make sure your script is on the gameobject you are adding to the onclick button!
@FreshDyl27 Жыл бұрын
Thanks! I finally got it working
@Pation655 Жыл бұрын
what extensions are you using for vscode?
@garrettdeveloper Жыл бұрын
Hi, I'm just using vscode with unity c#!
@spiritowlgaming43597 ай бұрын
The text for my button isn’t showing up like yours
@Lopeanti9 ай бұрын
why is my lighting now bugged?
@therealokla7 ай бұрын
how do i even add a canvas it doesnt let me
@TheHkon Жыл бұрын
my lighting in the game gets dark when i use the menu, what do i do?
@cupofnoodles3247 Жыл бұрын
I fixed it by going to Window>Rendering>Lighting and and click New Lighting Settings and unchecking Baked Global Illumination and checking Auto Generate.
@minilaatikko Жыл бұрын
@@cupofnoodles3247 Thank you so much this worked :D
@bongoknight1217 Жыл бұрын
i cant get the button to highlight and change color when i press it. im using unity 2019 but i dont really see what the problem is.
@garrettdeveloper Жыл бұрын
Make sure you're using text mesh pro!
@NOTCOOLP4 ай бұрын
How do I go back to my map
@DasShadePlays Жыл бұрын
but how do you make it so when you're in game you can pause it?
@garrettdeveloper Жыл бұрын
I have a tutorial for that too! Check my channel for the series of tutorials for this main menu.