Тёмный

Create great GAME OVER screen in Unity UI - Unity tutorial 

Coco Code
Подписаться 52 тыс.
Просмотров 232 тыс.
50% 1

Опубликовано:

 

1 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 135   
@UnravelCuriosities
@UnravelCuriosities 3 года назад
all fun and games till he shows the game controller
@worldtrending24.76
@worldtrending24.76 Год назад
the first code using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class restartgame : MonoBehaviour { variables public gameoverscreen Gameoverscreen; int maxplatform = 0; public void gameover(){ Gameoverscreen.setup(maxplatform); } private void Awake() void start() void spawnplatforms() void spawn10more() public void touchedplatform(string name) } secund code using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; public class restartgame : MonoBehaviour { public void restartbutton(){ SceneManager.LoadScene("game"); } public void exitbutton(){ SceneManager.LoadScene("mainmenu"); } }
@mentalabuser6559
@mentalabuser6559 8 месяцев назад
You are humanity's last hope Dear worldtrending24.76
@CocoCode
@CocoCode 3 года назад
💜 Would love to see your Game over screens on 🥥COCO CODE Discord: discord.gg/hNnZRnqf4s
@556mm4
@556mm4 2 года назад
for those whose background doesn't appear, don't forget to put the game over script into the player trigger script, then call GameOver();
@CassiusJohnAdams
@CassiusJohnAdams 3 года назад
Thanks for the tutorial. Also, today I learned that you can call a method on a disabled GameObject whose script has SetActive in it and it'll activate the same object! Thank you for that too!
@mina7572
@mina7572 2 года назад
How and where do you call the GameOver method? How would you handle a score that is in game before the game over screen? Thank you.
@shxrdz9628
@shxrdz9628 Год назад
get the scor var and put that into the gameoverscreen script so you can display that text
@basicallybruh9769
@basicallybruh9769 3 года назад
everything works correctly except the buttons don't work whatsoever... i have the same methods and attached them to the buttons but i am still able to see the character move after they die, so is there something i am missing with pausing the game or something?
@unamusedrowlett6303
@unamusedrowlett6303 3 года назад
Good tutorial. only thing is i found a "glitch" where when i press the button to load the scene, everything appears but the game freezes and i can't do anything. does anyone have a fix for this??
@PoddyBrawlstars
@PoddyBrawlstars 2 года назад
4 months later, you probably set the time.deltatime to 0 upon death, try setting to 1 in the start method so that everytime the scene reloads the speed will be normal and wont freeze
@NigeryjskaDysplazja
@NigeryjskaDysplazja 2 года назад
@@PoddyBrawlstars Same problem, and ur solution helped me. Thank You soooo much!
@aikiadu7995
@aikiadu7995 3 года назад
what do i have to write in the brackets after "GameOverScreen.Setup()" cuz i dont know what he means with "Pass in points"
@scree06
@scree06 3 года назад
Whatever you are calling your score counter in your script. So it may be score, points, etc.
@ulasonen9071
@ulasonen9071 3 года назад
How and Where is GameOver method called?
@vilanstrikegaming5114
@vilanstrikegaming5114 2 года назад
This is a great tutorial and i need help with the game controller script
@cognosce6193
@cognosce6193 3 года назад
god damn thank you for that tutorial, I spent a lot of time trying to find a decent one
@princetruth28
@princetruth28 2 года назад
I would like to say thank you for your focus on the UI aspect of Unity, you're a reference for me in the matter. Keep up your work !!
@xDTHECHEMISTx
@xDTHECHEMISTx 2 года назад
after following your tutorial i keep getting error about "Text" not being found. why is that? This code in the GameOverScreen script public Text pointsText; public void Setup(int score) { gameObject.SetActive(true); pointsText.text = score.ToString() + "POINTS"; }
@CocoCode
@CocoCode 2 года назад
Are you sure you've typed "using UnityEngine.UI" at the very top of the script?
@Phantaric
@Phantaric 2 года назад
I really liked this tutorial the only problem is I can't figure out how to get the game over screen to trigger. like in your game, its when your little guy hits the bottom of the screen. what does that code look like?
@ruinamuckyfuddle
@ruinamuckyfuddle 2 года назад
Exactly, it's a really good tutorial but there is no trigger in this one that I can see. I am assuming that he has some logic somewhere that calls this GameOver() method.
@bobbville
@bobbville 2 года назад
Hey the way I did it was by using onCollisionEnter2D instead of is trigger then I used a co Routine to handle the dying animations and game over menu. Maybe try not using trigger?
@finalproject8821
@finalproject8821 Год назад
Any workaround on this after a year?
@JasperFunk
@JasperFunk Год назад
Its going to depend on how you do it, if you are making a different style game, then your trigger will be different. If you are trying to copy his game then you could probably use a collider on a 2d object and when the player hits that collider, it triggers the end.
@gealastefan813
@gealastefan813 3 года назад
Nice tutorial this definatly helped me
@turtlecabaret
@turtlecabaret 20 дней назад
great tutorial! how would you make the game over screen 'fade in' after the player loses? i'm trying to change the alpha of the background in my script in an IEnumerator but having trouble, any tips?
@thejahoobasdeveloper
@thejahoobasdeveloper 2 года назад
what is game over screen supposed to be? im getting an error: error CS0246: The type or namespace name 'GameOverScreen' could not be found (are you missing a using directive or an assembly reference?)
@danielnunoavina
@danielnunoavina Год назад
Okay but what's the code for the death? when he falls he collides with a box collider? why did u skip that part, I'm a begginer :c
@TheOnlyKaas
@TheOnlyKaas 2 года назад
this doesn't even kind of work for what I'm doing!
@ramelsteel3782
@ramelsteel3782 2 года назад
public gameoverscreen gameoverscreen? wtf
@alexbratov3095
@alexbratov3095 7 месяцев назад
You didn't explain you have to put in the Event System for buttons to work. Spent half an hour to figure that out.
@chickenwizardthethird9386
@chickenwizardthethird9386 3 года назад
i hate life... i just wanted a way to connect my health code to a game over screen.
@stopingscammers9720
@stopingscammers9720 2 года назад
I wish you would show how to make it appear when you loose....
@scree06
@scree06 3 года назад
How do I add the game controller? I'm still new to this, and I'm trying to adjust my own project. It's not working because certain parts aren't called
@mei4195
@mei4195 3 года назад
Same
@sairampidugu6161
@sairampidugu6161 2 года назад
Same problem i faced Still i can't fix the errors
@bobbville
@bobbville 2 года назад
@@sairampidugu6161 which part isn't working? If you don't have any compiler errors, you should just be able to drag and drop on top your objects??
@slingerbuikers
@slingerbuikers Год назад
I NEARLY FELL INTO MY OWN MEAT GRINDER WHILE WATCHING THIS TUTORIAL.
@psychicpython46
@psychicpython46 Год назад
Are you insane?
@slingerbuikerslive2462
@slingerbuikerslive2462 Год назад
no just obese
@who8554
@who8554 2 года назад
can someone tell me what is the maxPlatform for? bcuz when my player dead, the game over menu not show up, and idk how to call the game over menu (sorry for my english)
@ryanem969
@ryanem969 Год назад
I have no idea. I'm not able to move ahead because I don't know what his "maxPlatform" is.
@Hund335
@Hund335 3 года назад
in my game before this tutorial after death it just freezes xD and one question how can i blend out an other canvas with score usw? edit: fixed it
@hassanruben1019
@hassanruben1019 3 года назад
pro tip: you can watch movies at Flixzone. I've been using it for watching loads of movies lately.
@gaellucas8705
@gaellucas8705 3 года назад
@Hassan Ruben Yea, I've been watching on flixzone for years myself :)
@fabianlo234
@fabianlo234 10 месяцев назад
Can you give me the video for making the Game Controller script pls. Pls, pretty pls.
@fabianlo234
@fabianlo234 10 месяцев назад
I mean the link.
@siplay885
@siplay885 18 дней назад
HOW I KNOW WHAT IS MY SETUP3:57
@AKumar1992
@AKumar1992 3 года назад
Everything works except for the buttons. When i click them nothing happens
@maxisneis6791
@maxisneis6791 3 года назад
same here
@yuki_mosu
@yuki_mosu 3 года назад
What I have to do if after "try again" cubes change colors to darker one?? Say please.
@isimsizanimator1291
@isimsizanimator1291 Год назад
i dont have regular text just have textMeshPro i dont have any font
@sophiashanthan8101
@sophiashanthan8101 Год назад
Go to UI, hover over the option Legacy, and you'll see Text
@maxisneis6791
@maxisneis6791 3 года назад
restart button not working?
@csgog4ming48
@csgog4ming48 3 года назад
its dosnt work thanks
@byram_brt
@byram_brt 11 месяцев назад
i stopped game with time.timescale=0; but i cant work this code "Button.interactable=true;" i searched and i probably i need to solve this with time.unscaledTime but how can i do it? help me plz
@ethanb8361
@ethanb8361 3 года назад
What should I put instead of maxPlatform?
@CocoCode
@CocoCode 3 года назад
It depends on your game! It can be time value, reached level and more 🕺
@baoaichauvo4893
@baoaichauvo4893 Год назад
Why i have error namespace name 'GameOverScreen' could not be found
@samorian7397
@samorian7397 3 года назад
I don't know how to fix it.
@HUSS_BOSS
@HUSS_BOSS 2 года назад
The problem with me that game over UI is showing while playing I don't know the reason.
@Lost_S
@Lost_S Год назад
neither exit nor restart appear as options in 5:40, no idea why honestly im this close to giving up just because of the sheer amount of problems that Im having that defy logic itself
@adityadwi9077
@adityadwi9077 9 месяцев назад
Why doesn't my screen appear??
@WarTutel
@WarTutel Год назад
i have a problem the load scene does not want to load.
@davidemmanuel7603
@davidemmanuel7603 Год назад
if i fail my coins do not restart they just continue
@shailnakum9601
@shailnakum9601 3 года назад
What If I have multiple levels then what should I enter in the public void RestartButton() {SceneManagaer.LoadScene(" "); ?
@rasmus5990
@rasmus5990 Год назад
but i dont have a game controller script
@fabianlo234
@fabianlo234 10 месяцев назад
What does ... mean in the scripts?
@sebastianjones3815
@sebastianjones3815 3 года назад
thank you so much for this great vid it really helped me
@Malthazar1
@Malthazar1 Год назад
I cant't do this because I can only use TextMeshPro
@axdi9189
@axdi9189 Год назад
1) At the beginning of our script, we need to say that we want to use the TextMesh Pro codeset. This can be done as follows: using TMPro; 2) Also, the variable's type will no longer be "Text". Instead of "Text" we will use the type "TextMeshProUGUI". hope it helped :p
@agonzio2107
@agonzio2107 2 года назад
Thanks man, great video, worked like a charm.
@UnravelCuriosities
@UnravelCuriosities 3 года назад
Can anyone please help me on this error --> Member modifier 'public' must precede the member type and name
@UnravelCuriosities
@UnravelCuriosities 3 года назад
its from the public GameOverScreen GameOverScreen; line
@704tuti
@704tuti Год назад
How do you stop the game from being played in the background? The screen pops up but the game can still be played?
@CocoCode
@CocoCode Год назад
The easiest way would be to type Time.timeScale = 0; You can read more about it here: docs.unity3d.com/ScriptReference/Time-timeScale.html
@Зелёнаяферма3
@Зелёнаяферма3 3 года назад
Good job
@g4m3z24
@g4m3z24 Год назад
My borthday was today ;-;
@anonymousk5899
@anonymousk5899 Год назад
Hi i need unity pro for free
@Umrjak
@Umrjak Год назад
what if i make the game over UI in another scene instead and move to that scene when the game is lost?
@rekhapandey3941
@rekhapandey3941 Год назад
But how to add game over sound
@aljonmariano8447
@aljonmariano8447 3 года назад
why is it after I press the button It works how it should be but suddenly freezes the game?
@uchihai_a_h4871
@uchihai_a_h4871 3 года назад
damn ! even in 4k 😆
@CocoCode
@CocoCode 3 года назад
Doing my best to keep the best quality - sometimes small Unity elements may be difficult to read
@8DSONGENG
@8DSONGENG 3 года назад
Nice tutorial! keep up bro
@CocoCode
@CocoCode 3 года назад
Thanks!
@Lucky-.-
@Lucky-.- 2 года назад
This is a really good tutorial, thanks!
@mandyronald8187
@mandyronald8187 3 года назад
this method doesnt work with prefabs. when you try to load the object it disappears
@random_precision_software
@random_precision_software 3 года назад
How do I get a spectrum and c64 loading type screen on unity?
@Kackenswert
@Kackenswert 3 года назад
thank you thank you thank youuuuu thaaaaaanks omg
@redeiking5289
@redeiking5289 3 года назад
hello, i am a beginner and i followed brackeys tutorial to create my first game. How can i add this game over game to my project? it is different from your
@psadicodes
@psadicodes 2 года назад
how do i make that to resume from current level?
@ToastMah
@ToastMah 3 года назад
what's considered the game controller by the way? I'm getting errors from it and i dunno what it is. (I'm new to coding)
@kami1o427
@kami1o427 2 года назад
Maybe a Script you have? I'm not following the tutorial, but I assume it since its what he used it in the video.
@bonkthesystem
@bonkthesystem 2 года назад
Nice tutorial, but when I do the Alt + click for the size it just get really big and in a weird position.
@leonardobrandalise8824
@leonardobrandalise8824 3 года назад
GOOD video bro, thank you.
@tharabhaijoinderek3395
@tharabhaijoinderek3395 2 года назад
thanks made it work even with my way
@ozgurozanozbay2346
@ozgurozanozbay2346 Год назад
Thank you so much!
@orhanorhan2442
@orhanorhan2442 2 года назад
thanks 😊
@josemartinfriasaguirre1591
@josemartinfriasaguirre1591 2 года назад
thanks
@Mzain.
@Mzain. 3 года назад
what can i change max platform too?? 3:50
@savageyt4680
@savageyt4680 3 года назад
Have the same problem idk
@LixTheYT
@LixTheYT 2 года назад
I love your tutorials
@adamblanza6937
@adamblanza6937 3 года назад
could i also use that for topdown games as well? the only problem is that i dont have gravity effects, any tips?
@drewster237
@drewster237 Год назад
Just know when the players HP is = 0, and then call the GameOver() function :D
@marixxyt
@marixxyt 3 года назад
Hey! How can I do that if the Game over screen appears, buttons to move my character will not work or sounds stop?
@CocoCode
@CocoCode 3 года назад
You can create a variable like "bool isGameOver = false" which turns to 'true' when GameOver is visible. Based on that, you can check with each input if this variable is set to false.
@samorian7397
@samorian7397 3 года назад
For me it says that ; is not expected.
@andytheoriginalname5722
@andytheoriginalname5722 3 года назад
You forgot to write ; after some line of code
@flaviokonti5522
@flaviokonti5522 3 года назад
Learn to read your errors, everything is easy to understand from them
@MrDelord39
@MrDelord39 3 года назад
Great tutorial. Thank you :)
@fl3xxo492
@fl3xxo492 3 года назад
How to do it without player
@CocoCode
@CocoCode 3 года назад
Could you please specify?
@fl3xxo492
@fl3xxo492 3 года назад
Like if you have game without player like some more items for player how to do score on the geover screen
@m.b.a5260
@m.b.a5260 3 года назад
how did you make the corners soft
@CocoCode
@CocoCode 3 года назад
Check out this video! Master your Unity UI Buttons! - Unity UI tutorial ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-cW-E4WEogzE.html
@m.b.a5260
@m.b.a5260 3 года назад
@@CocoCode Thanks sir
@rafaellauxen3577
@rafaellauxen3577 3 года назад
good video, thank you!
@CocoCode
@CocoCode 3 года назад
Glad you liked it!
@finalproject8821
@finalproject8821 Год назад
@@CocoCode how to get the code for when your user drop to the bottom and die?
@ChrizBob
@ChrizBob 3 года назад
it didn't work :(
@CocoCode
@CocoCode 3 года назад
I invite you to coco code Discord, hope I'll be able to resolve your issue there! discord.gg/hNnZRnqf4s
@jatishkathard4427
@jatishkathard4427 3 года назад
is there a line of code that can make my score go back to zero after restarting the game. My game starts with the same score as when i died plsss help
@siamazing0828
@siamazing0828 3 года назад
just basically put your score in the void Start() function and set it there to be zero, so that every time the script run/ the game reloads it reads the script and will see that the points will be set again to 0
@flgaming2165
@flgaming2165 3 года назад
Hi Im having Trouble I keep getting the Error GameController.cs(10,5): error CS1585: Member modifier 'public' must precede the member type and name This is the Code Can You Help ??? using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class GameController : MonoBehaviour { variables public GameOverScreen GameOverScreen; int maxPlatform = 0; public void GameOver() { GameOverScreen.Setup(maxPlatform); } private void Awake(); void Start(); void SpawnPlatforms() ; void Spawn10More() ; public Void TouchedPlatform(string name) ; }
@flaviokonti5522
@flaviokonti5522 3 года назад
Uh buddy, where to start!?
@UnravelCuriosities
@UnravelCuriosities 3 года назад
Have you fixed it? can you please tell me what did you do?
@basharblus
@basharblus 3 года назад
i have the same problem plz tell me how if u fixed it plz
@whoami.....
@whoami..... 2 года назад
year later, maybe you didn't closed the brackets? public class GameController : MonoBehaviour { variables public GameOverScreen GameOverScreen; int maxPlatform = 0; // like here must be brackets or idk bc at the next line bracket is opening so public void GameOver() {
@Junior.Store.Google.Play.
@Junior.Store.Google.Play. Год назад
thank you
Далее
Game Over Screen Unity Tutorial
14:35
Просмотров 44 тыс.
Дикий Бармалей разозлил всех!
01:00
My Favorite Way To Make A GAME OVER Menu In Unity
14:41
How to make a finish line in Unity 2D/3D 2021
6:53
Просмотров 25 тыс.
PAUSE MENU in Unity
12:13
Просмотров 988 тыс.
TOUCH CONTROLS in Unity!
16:09
Просмотров 1,3 млн
How to make a menu in Unity - UI Tutorial
26:27
Просмотров 187 тыс.
I Oversimplified Famous Games
12:41
Просмотров 14 тыс.
MAIN MENU in Unity - Unity UI tutorial
14:59
Просмотров 128 тыс.