Making a Modal Window in Unity

Поделиться
HTML-код
  • Опубликовано: 29 июл 2021
  • The first 1,000 people to use this link will get a 1 month free trial of Skillshare: skl.sh/gamedevguide07211 - 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.unity.com/top-asse...
    Free Unity Assets! - assetstore.unity.com/top-asse...
    New on the Asset Store! - assetstore.unity.com/top-asse...
    Top Paid Asset Store Packages - assetstore.unity.com/top-asse...
    Asset Store Partners - assetstore.unity.com/lists/as...
    --------------------------------------------------------------------------------
    Socials and Other Stuff:
    • Subscribe - ruclips.net/user/gamedevguide?...
    • Join the Discord - / discord
    • Twitter - / gamedevguideyt
    • Facebook - / gamedevguideyt
    • Instagram - / gamedevguideyt

Комментарии • 107

  • @GameDevGuide
    @GameDevGuide  2 года назад +19

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

    • @JC-dd7ek
      @JC-dd7ek 2 года назад

      Thx

    • @Mr.IN3V1T4BL3
      @Mr.IN3V1T4BL3 2 года назад

      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 2 года назад +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 года назад +29

    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 9 месяцев назад +2

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

  • @KamaKase
    @KamaKase 2 года назад +16

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

  • @ben_burnes
    @ben_burnes 2 года назад +11

    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.

  • @dailydoseofhalal6767
    @dailydoseofhalal6767 2 года назад +2

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

  • @tingwen1713
    @tingwen1713 2 года назад

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

  • @enchart
    @enchart 2 года назад

    Been waiting for this tutorial for so long!

  • @r1pfake521
    @r1pfake521 2 года назад +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 2 года назад +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)

  • @taharvingames
    @taharvingames 2 года назад +1

    Just on time :). I love it

  • @alon_vita
    @alon_vita 2 года назад

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

  • @ggre55
    @ggre55 2 года назад

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

  • @samuelrussell5259
    @samuelrussell5259 2 года назад

    Another absolute banger! Great content

  • @williamtetlie4274
    @williamtetlie4274 2 года назад

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

  • @Steveplays28
    @Steveplays28 2 года назад

    Very nice tutorial, Game Dev Guide! :D

  • @vitiet8229
    @vitiet8229 2 года назад

    Awesome content as always!

  • @MsPlone
    @MsPlone 2 года назад

    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

  • @branidev
    @branidev 2 года назад

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

  • @rutchjohnson
    @rutchjohnson 2 года назад

    Great video! Super useful! :)

  • @TheRealMobiius
    @TheRealMobiius 2 года назад

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

  • @paulorodriguez6288
    @paulorodriguez6288 2 года назад +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

  • @rimoldi98
    @rimoldi98 2 года назад +21

    This is probably the most underrated channel on youtube

  • @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

  • @rashiddev7545
    @rashiddev7545 2 года назад +2

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

  • @darthshuichi3453
    @darthshuichi3453 2 года назад

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

  • @finishsuffering
    @finishsuffering Год назад +1

    insane greatful!

  • @PreslavKolev
    @PreslavKolev 2 года назад

    Finally a new video!!!!

  • @allanmacdonald2943
    @allanmacdonald2943 2 года назад

    awesome video!

  • @alaslipknot
    @alaslipknot 2 года назад +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 ?

  • @cianb5047
    @cianb5047 2 года назад +1

    I love your content

  • @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.

  • @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?

  • @BrontoKroxig
    @BrontoKroxig 2 года назад +1

    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? ^^

  • @tommasomaestri3107
    @tommasomaestri3107 2 года назад

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

  • @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!

  • @ngjiayi2705
    @ngjiayi2705 2 года назад

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

  • @dotaportalvideo
    @dotaportalvideo 2 года назад +8

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

  • @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.

  • @hoangduong5954
    @hoangduong5954 2 года назад

    u are so underrated

  • @jayvatar
    @jayvatar Год назад +4

    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 Год назад

      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 Год назад

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

  • @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.

  • @mitotv6376
    @mitotv6376 Год назад

    Nice

  • @DeLaBerni
    @DeLaBerni 8 месяцев назад +2

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

  • @SaiponathGames
    @SaiponathGames 2 года назад

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

  • @The28studio
    @The28studio 2 года назад +1

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

  • @Mr.IN3V1T4BL3
    @Mr.IN3V1T4BL3 2 года назад +1

    Can u make a video on mod installing system in unity

  • @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

  • @GingerNingerish
    @GingerNingerish 2 года назад

    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

  • @twibby6625
    @twibby6625 2 года назад +2

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

    • @GameDevGuide
      @GameDevGuide  2 года назад +1

      Yep it's a "get" shortcut.🙂

    • @Salmonman0604
      @Salmonman0604 2 года назад +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.

  • @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!

  • @LinharitoHervvon
    @LinharitoHervvon Год назад

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

  • @pbliable
    @pbliable Год назад +1

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

  • @souifilyes2873
    @souifilyes2873 Год назад

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

  • @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

  • @damionmccoy9966
    @damionmccoy9966 4 месяца назад +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.

  • @johnleorid
    @johnleorid 2 года назад

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

  • @laserbean00001
    @laserbean00001 6 месяцев назад

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

  • @fakydev
    @fakydev 2 года назад

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

  • @mad_man_86
    @mad_man_86 2 года назад +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_ 2 года назад +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 2 года назад

      @@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 :)

  • @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 9 месяцев назад

      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.

  • @laserbean00001
    @laserbean00001 6 месяцев назад

    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.

  • @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 }

  • @nocultist7050
    @nocultist7050 2 года назад +8

    Too fast.

  • @TheBurriagas
    @TheBurriagas 2 года назад

    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  2 года назад +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 2 года назад

      @@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 2 года назад +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 ?

  • @riverboatgambler3401
    @riverboatgambler3401 2 года назад +7

    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.

  • @themaskyyt
    @themaskyyt 2 года назад

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

  • @GymCritical
    @GymCritical 2 года назад

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

  • @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

  • @pinkhairblackman8141
    @pinkhairblackman8141 Год назад +2

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

  • @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.

  • @pbliable
    @pbliable Год назад +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 Год назад

      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

  • @dirt410
    @dirt410 Год назад +4

    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 9 месяцев назад

      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);

  • @srbiscuit
    @srbiscuit Год назад +2

    Nice tutorial but way too fast

  • @Gonzakoable
    @Gonzakoable 2 года назад

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

  • @nico_kempe
    @nico_kempe 2 года назад

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

  • @AllThatLOZ
    @AllThatLOZ 11 месяцев назад +1

    too quick

  • @hoangminhnguyen9571
    @hoangminhnguyen9571 4 месяца назад

    Way too fast and there are jump cut edit everywhere.

  • @nathanmaximiano8774
    @nathanmaximiano8774 2 года назад

    like like like like