Making a Modal Window in Unity

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ส.ค. 2024
  • The first 1,000 people to use this link will get a 1 month free trial of Skillshare: skl.sh/gamedev... - Modal windows are a crucial part of Game UI, so let's make one in Unity that's flexible and versatile!
    Levelling Up Animations: • Using IK to Improve An...
    Tooltip System: • Designing A Responsive...
    Making UI That Looks Good: • Making UI That Looks G...
    --------------------------------------------------------------------------------
    Want to support the channel?
    ▶️ Help fund new episodes by joining the Patreon - / gamedevguide
    Use these links to grab some cool assets from the asset store:
    Get the Must Have Assets! - assetstore.uni...
    Free Unity Assets! - assetstore.uni...
    New on the Asset Store! - assetstore.uni...
    Top Paid Asset Store Packages - assetstore.uni...
    Asset Store Partners - assetstore.uni...
    --------------------------------------------------------------------------------
    Socials and Other Stuff:
    • Subscribe - www.youtube.co...
    • Join the Discord - / discord
    • Twitter - / gamedevguideyt
    • Facebook - / gamedevguideyt
    • Instagram - / gamedevguideyt

ความคิดเห็น • 110

  • @GameDevGuide
    @GameDevGuide  3 ปีที่แล้ว +19

    The first 1,000 people to use this link will get a 1 month free trial of Skillshare: skl.sh/gamedevguide07211

    • @4.8olympos
      @4.8olympos 3 ปีที่แล้ว

      Thx

    • @Mr.IN3V1T4BL3
      @Mr.IN3V1T4BL3 3 ปีที่แล้ว

      Can u make a video on mod installing system in unity

    • @unluckyyooo6598
      @unluckyyooo6598 ปีที่แล้ว

      _declienButton.gameObject.SetActive(!hasTitle); otherwise it will never display the title with information

  • @ZahhibbDev
    @ZahhibbDev 3 ปีที่แล้ว +45

    I adore this channel because it's one of the few that actually goes fairly in-depth on UI, and as an aspiring UI/UX designer I just love to learn more on how to create these things! :p

    • @rmt3589
      @rmt3589 ปีที่แล้ว

      You should check out the Non-Designer's Design & Type Book.
      It's essential to any kind of graphic designer.
      I'm trying to learn unity. I'm fluent in HTML and CSS, but those don't transfer well. C# is a completely different beast!

  • @Jesus-fi9kp
    @Jesus-fi9kp 2 ปีที่แล้ว +31

    I am grateful for the free content, but please, make those sequences a little bit slower next time!! They are incredibly fast ... So we can get these useful tips for learning ... Thank you!

    • @draganjonceski2639
      @draganjonceski2639 11 หลายเดือนก่อน +3

      yes i have to pause almost every second and sometimes go frame by frame looking very closely at what is happening

  • @KamaKase
    @KamaKase 3 ปีที่แล้ว +16

    Highly recommend using a builder pattern for configuring the modal. Much easier to maintain than multiple constructors.

  • @r1pfake521
    @r1pfake521 3 ปีที่แล้ว +17

    Don't forget that the Dialog Panel must be the last child in the canvas so that it is drawn above every other UI element and blocks the clicks properly

    • @johnleorid
      @johnleorid 3 ปีที่แล้ว +12

      Or draw it on it's own Canvas with a higher sorting order, so you can never forget about it (and you can use it as a prefab in your main menu)

  • @ben_burnes
    @ben_burnes 3 ปีที่แล้ว +12

    I've created a TON of dynamic content from your videos. I love your teaching style because it shows the theory and methods of making this kind of stuff instead of "just copy paste this code in and you're done!" It's great to learn how this stuff works.

  • @rimoldi98
    @rimoldi98 3 ปีที่แล้ว +21

    This is probably the most underrated channel on youtube

  • @jayvatar
    @jayvatar ปีที่แล้ว +6

    Sorry this is not easy to follow. At some point it appears that you changed onConfirmAction to onConfirmCallback. Then you have UnityEvents with the callback suffix onContinueCallback, that are never used. Then all of a sudden you have onContinueEvent which I am assuming was the UnityEvent earlier. All this while rarely showing what file you are working in.

    • @unluckyyooo6598
      @unluckyyooo6598 ปีที่แล้ว +1

      Totally agree... I spent a few hrs going through the slow speed of the video, and now totally stucked on what are those. Have you figure it out?

    • @77eight8
      @77eight8 ปีที่แล้ว +1

      @@unluckyyooo6598 I spent 3 hours so far. Did you manage to make it work?

  • @williamtetlie4274
    @williamtetlie4274 3 ปีที่แล้ว

    the way you say, "Welcome, to Game Dev Guide" is really satisfying for some reason.

  • @shiv-iwnl8188
    @shiv-iwnl8188 2 ปีที่แล้ว +7

    I really want to learn this but your going too fast and jumping around everywhere in the tutorial so its very hard to follow

  • @dailydoseofhalal6767
    @dailydoseofhalal6767 3 ปีที่แล้ว +2

    Your videos are so well made and really easy to follow! Keep it up!

  • @VEOdev
    @VEOdev ปีที่แล้ว +1

    I good way to add is a transparent background that fill the screen so the player can't click something else while the window is open, and maybe add a button to the background so when the player click it the windows will close

  • @TheJasonCD
    @TheJasonCD 2 ปีที่แล้ว +5

    This is really cool but also... Really hard to follow. I've had to go through this a few times and things still aren't quiet right.

  • @KevinsTimeWasters
    @KevinsTimeWasters 2 ปีที่แล้ว +14

    Why so fast? And you barely show what you're doing, instead just explaining the concepts without much detail.
    There's a problem if I need the video at .5x speed to even have a CHANCE of following along.

    • @draganjonceski2639
      @draganjonceski2639 11 หลายเดือนก่อน

      yea you can use comma and dot key when it is paused to go frame by frame but that is to slow so i just used a framebyframe youtube watcher where you can set it to larger increments of frames and smaller seconds than the 5 or 10 that youtube does.

  • @StummyEnjoyer
    @StummyEnjoyer 2 ปีที่แล้ว +11

    Good tutorial but please show the code in the right order. I got stuck for 30 minutes on the continue-cancel- and alternate Callback part because you hadn't shown where they get created and referenced :-)
    EDIT: I've now watched the entire tutorial and Unity is giving me 14 context errors that didn't get brought up in the video :-)

    • @fearian
      @fearian 2 ปีที่แล้ว +1

      Same, I think the name changes from onContinueCallback, to onContinueAction between images!

  • @rashiddev7545
    @rashiddev7545 3 ปีที่แล้ว +2

    Although I have decided to leave the gaming development behind me but I still watch your videos. Keep it up.

  • @paulorodriguez6288
    @paulorodriguez6288 3 ปีที่แล้ว +3

    niceee, i'm finishing the UI for my project and i had to do a different modal script for every different case, but maaan i want to implement this method tho

  • @taharvingames
    @taharvingames 3 ปีที่แล้ว +1

    Just on time :). I love it

  • @alon_vita
    @alon_vita 3 ปีที่แล้ว

    Oh my god where were you 3 months agooooo!
    Awesome vid mate, as always!

  • @dotaportalvideo
    @dotaportalvideo 3 ปีที่แล้ว +8

    Some of the most engaging presentation of some of the driest topics. Not easy to do.

  • @TheRealMobiius
    @TheRealMobiius 3 ปีที่แล้ว

    That UI website at the start was made my a guy I work with! He's recently won an award for it as well!

  • @MsPlone
    @MsPlone 3 ปีที่แล้ว

    The picture you used is my desktop background lol
    Very good video btw. It's always nice to watch. I learn something and you have a very chill vibe

  • @enchart
    @enchart 3 ปีที่แล้ว

    Been waiting for this tutorial for so long!

  • @ggre55
    @ggre55 3 ปีที่แล้ว

    you are the best i really love what you do and tnks for the best tutorials i ever seen on youtube

  • @francoiss.8433
    @francoiss.8433 2 ปีที่แล้ว +7

    I've a little newbie question : In the ModalWindowPanel.cs, the close() command is not recognized after the Invoke...
    This is the header of my file :
    using System;
    using System.Windows;
    using UnityEngine;
    using UnityEngine.UI;
    using UnityEngine.Events;
    using TMPro;
    What did I miss ? Thanks for your help.

    • @galaxy-wy9sd
      @galaxy-wy9sd ปีที่แล้ว

      No

    • @unluckyyooo6598
      @unluckyyooo6598 ปีที่แล้ว

      He never showed it. There is also different variable name like onConfirmAction vs. onConfirmCallback at least that's my guess.

  • @riverboatgambler3401
    @riverboatgambler3401 2 ปีที่แล้ว +8

    This content is obviously intended for Unity experts. The entire video is basically on fast forward. It's literally impossible to slow the frame rate to a point where a rookie can follow what is going on. Bummer because it's potentially very valuable training. Minimally, posting an example project would be helpful

    • @77eight8
      @77eight8 ปีที่แล้ว +1

      True, I slowed down the video on 0,25x and still many parts were either not shown or skipped.

  • @tingwen1713
    @tingwen1713 3 ปีที่แล้ว

    Love this channel. I always learn so much from you!

  • @BrontoKroxig
    @BrontoKroxig 2 ปีที่แล้ว +2

    I don't really get how Content Size Filter and Layout Element works, documentation is not clear for me, any video-recommendation to learn how both component works? ^^

  • @DeLaBerni
    @DeLaBerni 10 หลายเดือนก่อน +2

    Is there a way to download the file ? This video is to fast for me!

  • @branidev
    @branidev 3 ปีที่แล้ว

    Yesterday I released video where i said UI needs a to be polished a lot and now this video! great!

  • @Andredy89
    @Andredy89 2 ปีที่แล้ว +2

    5:54 what means "=>" when assigning a variable? I know that this sign used with anonymous functions to quickly assign , but with vars?

  • @pbliable
    @pbliable 2 ปีที่แล้ว +1

    guess i gotta dl it and frame-by-frame it ...

  • @samuelrussell5259
    @samuelrussell5259 2 ปีที่แล้ว

    Another absolute banger! Great content

  • @finishsuffering
    @finishsuffering ปีที่แล้ว +1

    insane greatful!

  • @nocultist7050
    @nocultist7050 3 ปีที่แล้ว +9

    Too fast.

  • @The28studio
    @The28studio 2 ปีที่แล้ว +1

    Couple these with Scriptable objects and you will have very powerful UI system.

  • @cianb5047
    @cianb5047 3 ปีที่แล้ว +1

    I love your content

  • @Steveplays28
    @Steveplays28 3 ปีที่แล้ว

    Very nice tutorial, Game Dev Guide! :D

  • @mitotv6376
    @mitotv6376 ปีที่แล้ว

    Nice

  • @laserbean00001
    @laserbean00001 8 หลายเดือนก่อน

    It wasn't so clear, but are you just rewriting the stuff on the modal window? Like you don't instantiate a new modal window for each message? I guess that makes sense.

  • @vitiet8229
    @vitiet8229 3 ปีที่แล้ว

    Awesome content as always!

  • @damionmccoy9966
    @damionmccoy9966 7 หลายเดือนก่อน +1

    Man first of your Tutorials I have seen helpful but super hard to follow you should slow down and when you change variable names mid display say something so we don't spend 20 minutes trying to figure out where we went wrong. Or please have a link to the source so we can examine the code. Otherwise love the stuff can't wait to see more very helpful.

  • @twibby6625
    @twibby6625 3 ปีที่แล้ว +2

    5:58 what does the => mean ? Is that a shortcut for accessors get&set ?

    • @GameDevGuide
      @GameDevGuide  3 ปีที่แล้ว +1

      Yep it's a "get" shortcut.🙂

    • @Salmonman0604
      @Salmonman0604 3 ปีที่แล้ว +3

      That's called the lambda operator. It can be used in many ways, mostly used to create what's called an "expression bodied property" which is sort of like a method return consisting of just one line of code. One expression. Anything that the compiler can evaluate to a single value result. So in this case, yes, it's being used as a shorthand to create a getter property. But this syntax can't be used to make a setter property because it doesn't feature the "value" keyword for you to use. However you can define a method as an expression bodied property, using any parameters you'd pass into the method signature like normal. I use it for any method that can be evaluated in that single expression limit.

  • @rutchjohnson
    @rutchjohnson 3 ปีที่แล้ว

    Great video! Super useful! :)

  • @souifilyes2873
    @souifilyes2873 ปีที่แล้ว

    the methode Close(); isn't regognize how can i make it regognize

  • @darthshuichi3453
    @darthshuichi3453 3 ปีที่แล้ว

    great content! I hope you'll do UIElements soon. I love using it.

  • @laserbean00001
    @laserbean00001 8 หลายเดือนก่อน

    Shouldn't bool hasTitle = !string.IsNullOrEmpty(title);?

  • @PreslavKolev
    @PreslavKolev 3 ปีที่แล้ว

    Finally a new video!!!!

  • @alaslipknot
    @alaslipknot 3 ปีที่แล้ว +1

    Great tutorial as always!
    Question: are these characters yours or are they from a an asset ? if its the latter, could you share a link please ?

  • @puretrack06
    @puretrack06 2 ปีที่แล้ว

    Great Video. You can simplify this greatly just by using UnityEvents from the start. Can't see any real benefits from using actions.

  • @GingerNingerish
    @GingerNingerish 3 ปีที่แล้ว

    Oh my fucking god, I was wanting to know what these were called for so long. I was googling pop up boxes for ages and couldn't find anything

  • @allanmacdonald2943
    @allanmacdonald2943 3 ปีที่แล้ว

    awesome video!

  • @johnleorid
    @johnleorid 3 ปีที่แล้ว

    I think these should be static methods, which just don't do anything but sending a Debug.LogError() when the UI does not exist.

  • @hoangduong5954
    @hoangduong5954 3 ปีที่แล้ว

    u are so underrated

  • @ngjiayi2705
    @ngjiayi2705 2 ปีที่แล้ว

    Will you be doing a video on modulus window in unity?

  • @tommasomaestri3107
    @tommasomaestri3107 3 ปีที่แล้ว

    What should I do if I had a method to assign to one of the actions which required a parameter?

  • @tc61049
    @tc61049 2 ปีที่แล้ว +1

    I followed your code but the trigger class OnEnable() always go first and the Awake() in UIController Class go second.
    This cause null reference exception at the singleton (not assigned) in the UIController Class.
    How did you solve it?

    • @GameDevGuide
      @GameDevGuide  2 ปีที่แล้ว

      Try changing the script execution order so that the UI Controller is executed beforehand!

    • @tc61049
      @tc61049 2 ปีที่แล้ว

      @@GameDevGuideWow that was quick!
      It solved the problem! Thank you!! Love this channel!

  • @dirt410
    @dirt410 ปีที่แล้ว +5

    This is a good video, but not a good tutorial. I'm not new to unity in anyway, but there is no way you can follow along with anything being done here and understand how any of these components work, or how you should use them in combination with each other.

    • @draganjonceski2639
      @draganjonceski2639 11 หลายเดือนก่อน

      yeah if you have alredy made this in the past with looking at another tutorial and trying it out yourself it may be possible to get around the speed of this and the lack of import and code showing, for instance in the ShowPrompt function he has LeanTween.cancel(_box.gameObject). for starters i had to look at another video about tweening and find the library in the description, but i still have no idea what _box is, maybe it is in the parameters of the SHowPrompt function and its just another name for the panel, verby verbose for something that is esentialy panel.setactive(false);

  • @pinkhairblackman8141
    @pinkhairblackman8141 ปีที่แล้ว +2

    omfg why did you have to fast forward the ui, makes it so confusing and easy to make mistakes

  • @LinharitoHervvon
    @LinharitoHervvon ปีที่แล้ว

    onConfirmcallback = confirmAction
    CS0029 Cannot implicitly convert type 'System.Action' to 'UnityEngine.Events.UnityEvent'

  • @unluckyyooo6598
    @unluckyyooo6598 ปีที่แล้ว

    What are Close() and Show() ?

    • @mikeohc
      @mikeohc ปีที่แล้ว +1

      It's a method he didn't really show, but maybe void Close(){ //probably SetActive(false) to all UI gameobjects }

  • @fakydev
    @fakydev 3 ปีที่แล้ว

    You are basically a Mumbo Jumbo, but for unity :)

  • @stressbuster5500
    @stressbuster5500 2 ปีที่แล้ว

    my modal window is taking few seconds to resize. what can be the reason? and how to fix this issue? if anyone know about this issue please reply

  • @SaiponathGames
    @SaiponathGames 3 ปีที่แล้ว

    Nice! First to watch. Will try port this over to Godot.

  • @srbiscuit
    @srbiscuit ปีที่แล้ว +2

    Nice tutorial but way too fast

  • @TheBurriagas
    @TheBurriagas 3 ปีที่แล้ว

    How will u avoid clicking on buttons repeatedly? Like pressing “continue” 2 times before modal window closes. I think thats the first thing QA will report

    • @GameDevGuide
      @GameDevGuide  3 ปีที่แล้ว +1

      You can force the button to disable, and/or remove the callback in the button's method. So that as soon as the button is pressed, it only performs the action once.

    • @TheBurriagas
      @TheBurriagas 3 ปีที่แล้ว

      @@GameDevGuide I am thinking more of a generic solution for this. Removing the callback might led into confussion when button gets reused. I find myself doing the same logic controlling over the same class if button pressed == button clicked and I was wondering how would you solve it.

    • @charlesselrachski34
      @charlesselrachski34 3 ปีที่แล้ว +1

      @@TheBurriagas why don't you store a counter and if it pressed , ++, then next time in the func check if > 1 then ignore and do nothing ?

  • @Mr.IN3V1T4BL3
    @Mr.IN3V1T4BL3 3 ปีที่แล้ว +1

    Can u make a video on mod installing system in unity

  • @The_Ancient_Guardian
    @The_Ancient_Guardian หลายเดือนก่อน

    i love this channels but some times is just a...mess, to fast, i cant follow and have to go back all the time.

  • @pbliable
    @pbliable 2 ปีที่แล้ว +2

    wtf does "Content" have on it ?? i cant replicate your thing cause u dont show us ... whyyy???
    ... okay there is literally 1 frame at 4:09 where u click on it, okay, got it, ... jeez dude .. 1 frame ?

    • @pbliable
      @pbliable 2 ปีที่แล้ว

      speeding up the video is okay, if you then go over every setting / change ... orr if the speed is slow enough to catch and see with a pause ... but .. you never show us Content, only for 1 frame lol which is impossible to pause i frame-by-framed it in vlc

  • @themaskyyt
    @themaskyyt 3 ปีที่แล้ว

    Wait...you're telling me that all this time there was a web page literally called Game UI Database?...

  • @mad_man_86
    @mad_man_86 3 ปีที่แล้ว +1

    Thank you so much Mr. Guide! ;) Little issue I'm having: how do you ensure that UIController Awake is called before Trigger OnEnable? In my situation Unity complains about instance being null. Not the first time I struggle with this issue and I usually solve this by using events, but maybe you or someone here could tell me a better way to handle this :) Thanks!

    • @Khanguyen_
      @Khanguyen_ 3 ปีที่แล้ว +1

      Hey, I ran into this issue as well and fixed it by making sure that the UIController is executed first (Edit > Project Settings > Script Execution Order). The issue that we were having is very likely because the Trigger script's onEnable() was being called before the UIController's Awake(). I could be wrong, but this is what fixed it for me. good luck.

    • @mad_man_86
      @mad_man_86 3 ปีที่แล้ว

      @@Khanguyen_ thank you for the fast reply! I found this solution as well but I was hoping that there is another way, since I don't want to mess with the execution order. Guess that is one down-side of using a singleton in Unity. Nevertheless, thank you :)

  • @BrontoKroxig
    @BrontoKroxig 2 ปีที่แล้ว +1

    bool hasTitle = string.IsNullOrEmpty(title); shouldn't be *!*string.IsNullOrEmpty(title); ??

    • @maplestory344
      @maplestory344 2 ปีที่แล้ว

      this confused me so much too haha

  • @HAWXLEADER
    @HAWXLEADER 2 ปีที่แล้ว

    All hail Google Lens that helped me copy parts of the scripts to my computer.
    I now have a cooler Modal window system in my game!
    I could have written this system myself but Copy Paste is faster.
    I made the modal window panel as a prefab so that I can call if from anywhere in code.

  • @GymCritical
    @GymCritical 3 ปีที่แล้ว

    Matt, I need you to stop uploading videos as I need them, it’s creepy 😂

  • @bruhmanbruhmanzz
    @bruhmanbruhmanzz 7 หลายเดือนก่อน

    Way too fast and there are jump cut edit everywhere.

  • @Allbitable
    @Allbitable หลายเดือนก่อน

    I must be stupid. I don't get this tutorial. I'm 3 minutes in and he constantly jumps around frames at 10x speed, adding and removing components off-screen. This is the first time I see this kind of tutorial. Then he says "now we're just going to add rest of our components here" and adds them at 20x speed as if the viewer is supposed to know what the components are.
    I have watched through most of the playlist by now and the lessons are great, - and I know this video is 2 years old by now. But I really wish the guy spared a thought or two for people who watch this tutorial video while not already being masters of it's content.

  • @AllThatLOZ
    @AllThatLOZ ปีที่แล้ว +1

    too quick

  • @yeeeetsssusdelets
    @yeeeetsssusdelets หลายเดือนก่อน

    this is way too fast and half of the stuff is incorrect or incomplete. wonder if everyone who liked it even tried it out

  • @Gonzakoable
    @Gonzakoable 3 ปีที่แล้ว

    OK, before I go ahead on the vid I'm gonna guess you use some kind of content size fitter

  • @nico_kempe
    @nico_kempe 3 ปีที่แล้ว

    No one:
    Game Dev Guide: WINDOW WINDOW WINDOW WINDOW WINDOW WINDOW

  • @nathanmaximiano8774
    @nathanmaximiano8774 2 ปีที่แล้ว

    like like like like