Open and Close Menus with Buttons or Escape Key | Unity 2018 Game Development

  Рет қаралды 67,189

Chris' Tutorials

Chris' Tutorials

Күн бұрын

► My Unity 2020 Mini-Course - Make a 2D Platformer Character with State Machines ►
skl.sh/3lpWPQL
◢◤◣◥◢◤◣◥◢◤◣◥◢◤◣◥
Here's two ways that you can open and close your game menus inside of unity. The first is using the onclick events of UI buttons, and the other option is using your escape key pressses (or other keys on the keyboard). Script included below.
Menu Manager Script pastebin.com/Qyck2XAC
Download my scripts, game templates, and Unity assets ►► gumroad.com/christutorials
See My Full Software Courses
www.skillshare.com/r/user/chr...
www.udemy.com/user/chris-nava...
christutorials.teachable.com
➣ Also Follow Me On
Minds ►►bit.ly/ChrisTutorialsOnMinds
Gab.ai ►► gab.ai/ChrisTutorials

Пікірлер: 61
@reftu1489
@reftu1489 5 жыл бұрын
A short simple clear explanation. Thank you.
@WhyAreYouScared
@WhyAreYouScared 4 ай бұрын
was looking EXACTLY this and found what i wanted without timewaste , absolute LEGEND .
@19Lewi91
@19Lewi91 2 жыл бұрын
Exactly what I was looking for, thanks!
@123cottonball
@123cottonball 4 жыл бұрын
Thank you so much! This was very clear and informative : )
@matthewwilson9946
@matthewwilson9946 3 жыл бұрын
Absolutely brilliant. Cheers!
@artjom5617
@artjom5617 4 жыл бұрын
oh very cool, taking the oposite of the actual state with just one line of code, this is really cool, didnt know that.
@dominikfischer5175
@dominikfischer5175 Жыл бұрын
that´s a brilliant oneliner :)! thanks for showing.
@neuronumhu6719
@neuronumhu6719 5 жыл бұрын
Thanks! Inspires a lot~
@denizmogulkoc240
@denizmogulkoc240 Жыл бұрын
Thank you it was very simple and short and it worked.
@andrewshirk6554
@andrewshirk6554 Жыл бұрын
I had no idea how to do the toggle thing or that set active self was a thing. Thanks for the tutorial
@AKSenor24
@AKSenor24 5 жыл бұрын
Good job, thank you!
@kevdoesart8996
@kevdoesart8996 5 жыл бұрын
Awesome, thank you.
@Progy
@Progy Жыл бұрын
thanks, it helped a lot!
@gamesfordlegend
@gamesfordlegend 9 ай бұрын
Thanks bro.. very good tutorial..you have just helped me a lot thanks slot bro
@Taj-qx8wv
@Taj-qx8wv 2 жыл бұрын
Bruhh!!! Thanks dude, very helpfull!!!!
@ilberturkylmaz6328
@ilberturkylmaz6328 3 жыл бұрын
You are a legend!!
@marinelfoundation8210
@marinelfoundation8210 Жыл бұрын
Thanks Alot! Great DStuff
@user-on6kq2vz6s
@user-on6kq2vz6s 6 ай бұрын
Thanks buddy 🎉🎉
@UserRandomized
@UserRandomized 3 жыл бұрын
Is it possible to have one button control the enabling/disabling of the Options Menu gameObject? For example, using the same button to open and close the menu?
@austinbotterell1584
@austinbotterell1584 3 жыл бұрын
Thankyou so much!
@fransiscodelacalle7875
@fransiscodelacalle7875 Жыл бұрын
thank you bro
@ppsychodeliaa
@ppsychodeliaa Жыл бұрын
thank you so much! but is it possible to put animation when you close or open the tab?
@hassantanveer96
@hassantanveer96 4 жыл бұрын
What if I wanted to use the escape key and also have the ability to press the pause button in the top left corner? I have tried applying the onClick() function but it doesn't seem to work..
@noodleplexium5953
@noodleplexium5953 5 жыл бұрын
Biltong ZA_playz Instead of opening and closing an options menu, i am trying to Activate or Deactivate a game object (to hide or show the game object) it dosent want to toggle. Can someone help?
@Stormbreaker613UA
@Stormbreaker613UA 5 жыл бұрын
THX a lot!
@exosluckyone
@exosluckyone 2 жыл бұрын
this really helped me alot with my hw but now i cant get the menu to show underneath my mouse 😪😪 when i make the sorting layer smaller than the mouse layer the button doesnt work. im going crazy and its due in 2 days
@thepcgamer5151
@thepcgamer5151 2 жыл бұрын
Whenever I click on one of the buttons the mouse just disappears
@MuhammadFaizin
@MuhammadFaizin 3 жыл бұрын
Hi, can you share the source file? OptionsMenu class is not defined in my code. It makes this doesn't work
@spencerwells2496
@spencerwells2496 Ай бұрын
I've set up the toggle feature. The button works great for sending the menu away, but when I try to press the button again to bring it back, it doesn't happen. Anyone have any advice? Great video by the way!
@cyanuranus6456
@cyanuranus6456 Жыл бұрын
Tell Me How Any 3D Internet Game Engines. Like Unity. Have a 3D Internet Game Development Menus are All White in Color? Instead of Black like Unreal Engine?
@user-ft6gn3ku1d
@user-ft6gn3ku1d 3 жыл бұрын
thx bro! Hello from Russia
@snsd9254
@snsd9254 5 жыл бұрын
NullReferenceException: Object reference not set to an instance of an object Pause.Update () (at Assets/Scripts/Pause.cs:17)
@ubeydalkan8035
@ubeydalkan8035 4 жыл бұрын
THANKS SO MUCH.....
@Devon-bf9xh
@Devon-bf9xh 4 жыл бұрын
VEry helpful
@irfaalwan3590
@irfaalwan3590 3 жыл бұрын
why my if (Input.GetKeyDown(KeyCode.Escape)) you know 'blue' on visual studio?
@shaded8476
@shaded8476 4 жыл бұрын
Can u tell me how to create a toggle input for sprint and crouch and etc please am struggling here so please help me ...................
@eugenenovikov671
@eugenenovikov671 4 жыл бұрын
how to exit on escape? in what file to write applicaton.quit?
@bayonet1199
@bayonet1199 3 жыл бұрын
Assets\gotom.cs(7,12): error CS0246: The type or namespace name 'OptionsMenu' could not be found (are you missing a using directive or an assembly reference?)
@soltandream9975
@soltandream9975 2 жыл бұрын
did you find the solution ?
@AlexVollmannFilms
@AlexVollmannFilms 2 жыл бұрын
@@soltandream9975 I was able to clear this issue up by calling for a "GameObject" rather than "OptionsMenu". Written like: "public GameObject optionsMenu;" Hope that helps! :)
@micol04
@micol04 2 жыл бұрын
@@AlexVollmannFilms yes it did. thank you
@zimalshahbazvlogs5255
@zimalshahbazvlogs5255 5 жыл бұрын
its good
@frankkranktrangtmohammedny807
@frankkranktrangtmohammedny807 Жыл бұрын
For some reason It doesn't work for me, nothing happens when I click on the ESC key
@randomman2582
@randomman2582 3 жыл бұрын
For me "error CS0246: The type or namespace name 'Inventory' could not be found (are you missing a using directive or an assembly reference?)" keeps coming up.. does anyone know how to fix this thanks.
@landenty1525
@landenty1525 3 жыл бұрын
I'm not sure, but you could double click on the error, for it to take you into that script, & define what went wrong.
@adkinsy85
@adkinsy85 4 жыл бұрын
My problem is when I first time click play everything is fine but when I pause the game then press go to main menu button still everything is fine I'm in the main menu again now once i click play my game is automatically pause without anything showing on a screen that show that game is pause I have to press escape key to back to normal any idea what to do?
@gizliisim1943
@gizliisim1943 Жыл бұрын
I have big problem like this if ı make open and close with esc no problem but if ı make open esc and close resume button after that ı click esc pause menu open but if ı click space button pause menu closed how ı can repair this problem
@ZeeshanKhan-ny8pm
@ZeeshanKhan-ny8pm 5 жыл бұрын
How did you reference optionmenu? Please help
@SparrowValentine
@SparrowValentine 5 жыл бұрын
^^^
@creapermann6356
@creapermann6356 4 жыл бұрын
@@SparrowValentine ??
@goosebumps7663
@goosebumps7663 5 жыл бұрын
I lost the escape key in my keybinds and can't get to the keybinds because I have to go to options and you go to options with escape...
@funnymomentsman543
@funnymomentsman543 4 жыл бұрын
Thats a fat rip
@RinoMoen
@RinoMoen 4 жыл бұрын
How the hell do you get that list of sugestion while writing code? mine does not do that
@SophieAnteboth
@SophieAnteboth 4 жыл бұрын
kzfaq.info/get/bejne/ldxpoMZkycnbiXk.html maybe this tutorial to setting up vs code with unity helps
@mercedescardenas03c
@mercedescardenas03c 5 жыл бұрын
What if we want to open and close with the same button
@jonasberkmiller7603
@jonasberkmiller7603 5 жыл бұрын
You can create two buttons on the same place, but the close button behind the open button, and if you click on the open button, the open button will be deactivated and next time when you click there, you will click on the close button, and then the open button will be activated again. If you have some trouble, I can send you a video via e-Mail.
@CCLawhon
@CCLawhon 11 ай бұрын
I wish the popup ad thingies didn't cover the content so much. I need to be able to see the whole screen.
@3Danful
@3Danful 4 жыл бұрын
What if by clicking on the button the second time, the opened window will then close. this would make a clicking Loop, of "on and off"? And in most game the second part of your tutorial wouldnt trend in games. Usually a key on the keyboard, corresponding to the desired window/panel being open, would be used, and then the Esc would be used to close that window/panel. so for instance if its an inventory window/panel, you wish to open, then you would use "i" as the keybinding, and then pressing Esc, would lcose that window. also is true for clicking on "i" again would close the inventory window.
@Dusteezy810
@Dusteezy810 3 жыл бұрын
How are we supposed to do this when you don't show us the optionsMenu script you made
@shorty5146
@shorty5146 2 жыл бұрын
this tutorial was just to show how to open and close an optionsmenu
Easy 2D Tilemap Collisions | Unity 2018 Tutorial
3:25
Chris' Tutorials
Рет қаралды 137 М.
I Wish I Had Known This Before I Started Unity Game Development...
11:11
ОСКАР ИСПОРТИЛ ДЖОНИ ЖИЗНЬ 😢 @lenta_com
01:01
아이스크림으로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 53 МЛН
NERF WAR HEAVY: Drone Battle!
00:30
MacDannyGun
Рет қаралды 53 МЛН
Learning C# In A Week... Otherwise I Fail University
9:04
Using Menus with A Controller/Keyboard in Unity
14:34
gamesplusjames
Рет қаралды 75 М.
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 3,9 МЛН
How To Make UIs without frustration | Unity Beginner Tutorial
16:58
This is GameDev
Рет қаралды 29 М.
How I made an Excellent Platformer
8:25
GoldenEvolution
Рет қаралды 260 М.
PAUSE MENU in Unity
12:13
Brackeys
Рет қаралды 980 М.
A new way to generate worlds (stitched WFC)
10:51
Watt Designs
Рет қаралды 515 М.
Unity Tutorial: Open Panel on Button Click
3:39
Jayanam
Рет қаралды 170 М.
Handle Scene Transitions, Doors and Persistence like a Commercial Game
24:06
РИСКОВЫЙ ШКОЛЬНИК На велосипеде #shorts
0:15
Леха МАК
Рет қаралды 7 МЛН
ВЕЛОСИПЕД ЗАГОВОРИЛ
0:15
KINO KAIF
Рет қаралды 14 МЛН
🫓 Xorazim guch 💪  #littos
0:14
Littos Media
Рет қаралды 5 МЛН
Эй Рамазан # DamirAgroDizel
0:17
DamirAgroDizel
Рет қаралды 7 МЛН
Он просто решил сэкономить на плитке, но...
0:25