NO UI Prefabs!

Get the Code - game.courses/ingameui/
💯Multiplayer Mastery Course - game.courses/mp/
🎓Learn Game Development - game.courses/bc/
Join the Group - unity3d.group/
Support the Channel by becoming a Member - / @unity3dcollege
Scifi Characters InGame - assetstore.unity.com/publishe...
Fantasy Characters InGame - assetstore.unity.com/publishe...
Insects InGame - assetstore.unity.com/packages...
** GET SOME OF THE FANTASY & SCIFI CHARACTERS FOR $20 in the $20 SALE **
assetstore.unity.com/?price=1...

Пікірлер: 54

  • @reigota
    @reigota2 ай бұрын

    You work alone, right? Try that with just a few more UI artist/dev messing around...

  • @Unity3dCollege

    @Unity3dCollege

    Ай бұрын

    Yea in that scenario I'd split things out more so they have more granular control

  • @WatThaDeuce
    @WatThaDeuce2 ай бұрын

    I always end up fussing around with turning UI on and off as I develop and test, so this is very helpful, thanks!

  • @chanhaoen62
    @chanhaoen622 ай бұрын

    strange but feels good to know pressing play also takes such a long time even on jason's computer.

  • @AliMusllam
    @AliMusllam2 ай бұрын

    Hi Jason, I have similar solution for in editor scene initialization posted in unity forums. The solution does not requires you to add a prefab that load the scene, it automatically add it for you when enters play mode, and still maintain your current opened scenes in editor. If any one interested, the thread title in the unity forums is "Load required scenes before Awake/Start of objects when entering play mode from level scene".

  • @EricYoungVFX
    @EricYoungVFX2 ай бұрын

    4:26 such a brazen liar

  • @Macalaka
    @Macalaka2 ай бұрын

    really cool I will definitely give this a try. I'm pretty right now I have UI elements I tweaked and forgot to apply the override xD

  • @dreamisover9813
    @dreamisover98132 ай бұрын

    In some games I started making a prefab that is mainly just the canvas with its settings and components. Then I either use it in different scenes (that require different menus) to keep canvas configuration consistent, or I use it for prefab variants for menus.

  • @fokozuynen2048
    @fokozuynen2048Ай бұрын

    I actually use another scene just to make new stuff and test stuff for having the Hierarchy with more space since each time i change a prefab most of gameobjects collapse.

  • @amirsaeed8733
    @amirsaeed87332 ай бұрын

    That's a fantastic idea, specially because it forces you to write the UI code very loosely.

  • @outofbound28
    @outofbound282 ай бұрын

    I find ripping apart the if/else with a compile condition not very readable, to be honest. The else can be easily mistaken for a #else, or if you get into a situation where you need brackets in the if this can create weird results. Intermingling the #if and if doesn't "feel" right. It's a button, and not called very often. So being a bit more verbose here would help clean up the code readability, I think. Of course to each their own: if(Application.isPlaying) { SceneManager.UnloadSceneAsync("Ingame UI"); } else { #if UNITY_EDITOR Editor.SceneManager.CloseScene(...); #endif } I'm pretty sure the compiler is gonna strip away the second branch of the if statement as it recognizes the else is empty. I haven't decompiled the result, so I might be wrong here. If this was somewhere in the Update loop, I might actually decompile it and have a look.

  • @valhallagalex
    @valhallagalex2 ай бұрын

    How do you handle activating/deactivating specific ui like a scoreboard that might only pop up under specific conditions?

  • @orlovskyconsultinggbr2849
    @orlovskyconsultinggbr28492 ай бұрын

    Jason oh man, how could you not tell us this before! YES UI is a challenge ;)

  • @cagataysarp
    @cagataysarpАй бұрын

    How do you handle the scene specific things? Do you have an architecture for for example showing active character's available skills in the UI? Do you just register to a character selected event in the UI Scene or do you find the UI from game scene and update it from there ? Do you have specific scripts for these actions ? I wanted to try this aproach but having scene references breaks the workflow too much, simple "pause game" functionality kills the workflow in my experience

  • @valhallagalex
    @valhallagalex2 ай бұрын

    I’ve checked out the pamphlet for the course and I have a question, in the course intro you talk about a racing game and an adventure extraction game, but here you’re showing a MOBA. Do you classify mobas as adventure extractions, or did the curriculum change, or?

  • @Unity3dCollege

    @Unity3dCollege

    2 ай бұрын

    The coursework covers a peer to peer racing game and a top down extraction style game w/ persistence. The moba came from a quick experiment where I spent a few hours converting the extraction code to work like a moba. Since it turned out simple and fun I started building more of it and posting the code to the course page so students can dig through and take the stuff that's helpful. We've been discussing it a lot in the live calls, which is great for people to figure out how to use things but also for me to figure out what fun stuff to add :) Hoping to do a playtest w/ the group in the thursday call if I can get it polished by then

  • @anonymous49125
    @anonymous491252 ай бұрын

    not a horrible approach... I think it's a choose the lessor of all the evils type of thing. I usually just slap everything in the hierarchy, with each UI element (hp bar, mana bar, minimap, etc) with their game object disabled. I also link each of the UI elements to a 'ui manager' that can toggle on and off each of those elements. Technically all the UI is available at any time in the game (which has some upfront costs in performance at runtime - almost nothing, but not nothing), but it's better than hunting down a specific UI element at devtime and trying to figure out how it would look in the game to make changes. With the ui manager style, you can just toggle on the ui you want to edit, you can see it plainly, then you can just toggle it off when you're done. Very similar to this videos approach, but without the scene management stuff - which isn't a horrible approach either... you get most the same important benefits like seeing what you're editing, but also having the ability to get all the clutter off the screen. Also protip: when I use compiler directives for UNITY_EDITOR, I don't bother with the 'using' statement at the top, and just fully qualify the reference in the code - makes it like 1% more pretty that way to my eyes at least. Also being consistent with indenting the compiler directives are important as well - and I wouldn't single line 'if' statements on a good day and ESPECIALLY not mixed in with compiler directives, makes maintaining and reading an absolute pain. You even fell for some of the weirdly nested 'else' statements in this video - not easy on the eyes.

  • @bnaZan6550
    @bnaZan65502 ай бұрын

    Wouldn't you still be using prefabs? If you want to change the style of a button you wouldn't manually change every single one?

  • @Unity3dCollege

    @Unity3dCollege

    2 ай бұрын

    Yes for some of the sub components, but not for the canvas/top level anymore.

  • @phyzix101
    @phyzix1012 ай бұрын

    I will be doing this in my project for sure. Here's a question for you. Is there any reason why multiplayer games don't allow the chat interface to persist when on loading screens?

  • @anonymous49125

    @anonymous49125

    2 ай бұрын

    I personally think it's a holdover from the loading screen minigame patent that namco had in the 90s. Just until relatively recently, you really couldn't do anything on a loading screen that was interactive without infringing that specific patent. That patent expired a few years ago, but (I think) because the public is so acclimated to nothing interactive happening on loading screens that things like chat and even minigames are slow to be added to commercial products. tl;dr they couldn't legally, so they historically haven't. I think they technically 'could' do that now though without fear of infringement.

  • @Critters
    @Critters2 ай бұрын

    32 seconds from pressing play to it loading :|

  • @ilhanilhanDev

    @ilhanilhanDev

    2 ай бұрын

    I think this connected for loaded much more characters in one time. Man can change self to other objects with different skills

  • @kayumiy
    @kayumiy2 ай бұрын

    Should UI be separated from Game Logic?

  • @Micz84
    @Micz84Ай бұрын

    I would add an array of strings to make it more flexible and load several scenes if needed. That is that shame that it is impossible to just add Scene reference in inspector. That would prevent errors when somebody changes the name of the scene.

  • @alideveloper6945
    @alideveloper6945Ай бұрын

    hi Jason. i am creating industrial apps with Unity(Dispatching, Digital Twin and ...) and these apps have many complicated and nested UI and Panels which i cant use of just rasterize and unity prefabs. i need a vector base UI in Unity. one of my option is NoesisGUI, but it is too expensive. do you have any suggest?

  • @Unity3dCollege

    @Unity3dCollege

    Ай бұрын

    Everyone I've talked to about it seems to recommend noesis.. I know the sirinix team has a new ui framework in development that would be a great fit, not sure if it's available yet but I'd check. It seemed like a good one for this type of application, one of their sample uis was a full digital mixer

  • @AmfistomosAtlas
    @AmfistomosAtlas2 ай бұрын

    You are not using prefabs at all for your UI? I mean, what about buttons, check boxes, input fields and window designs that are quite reusable? Are you somehow skinning the default unity UI elements ?

  • @MaZyYTube

    @MaZyYTube

    Ай бұрын

    I think he is using few prefabs, but he wants to reduce prefabs overall if he needs to spawn it. Instead of spawning WHOLE Ui as prefab he just load the scene with ui. Like a prefab.

  • @alexleonardkrea
    @alexleonardkrea2 ай бұрын

    Very cool

  • @halivudestevez2
    @halivudestevez22 ай бұрын

    why separate scene? maybe my english is weak, but cannot see ... why? missed the point...

  • @halivudestevez2

    @halivudestevez2

    2 ай бұрын

    ach, I see: first you had UI elements one-by-one. But thought, you had 1 big prefab with all the GUI and HUD stuff.

  • @ilhanilhanDev
    @ilhanilhanDev2 ай бұрын

    Bro leave moment with playing for animals and monsters. It's cool

  • @flamingpenny
    @flamingpenny2 ай бұрын

    How do you have your UI elements find the in game objects and data they're trying to get information from?

  • @Unity3dCollege

    @Unity3dCollege

    2 ай бұрын

    They listen for the local character to change. You can swap them or select others at runtime so it has to dynamically bind to whatever character is active. Mightbdo a video on that soon. It's simple code and really handy, allows for lots of cool stuff

  • @LiviuMaricaiulian

    @LiviuMaricaiulian

    2 ай бұрын

    @@Unity3dCollege I'm looking forward to this video. I hope to be soon :)

  • @flamingpenny

    @flamingpenny

    2 ай бұрын

    Yes please ☺️ Ive always built UI the other way which is really cumbersome and coupling. Gameobjects instantiating UI elements for what they are trying to to represent.

  • @morphidevtalk

    @morphidevtalk

    Ай бұрын

    @@Unity3dCollege this will be really helpful!

  • @skeggs
    @skeggs2 ай бұрын

    It's as if you made a video you yourself would appreciate watching instead of shoving ads, dubstep and intros down our throats. Thanks bud! Now to test out UI as a Scene 🥳

  • @Hazzel31337
    @Hazzel313372 ай бұрын

    nice

  • @hldfgjsjbd
    @hldfgjsjbd2 ай бұрын

    But now instead of hustling with prefabs you hustle with scene loading

  • @maybe_ilya
    @maybe_ilya2 ай бұрын

    watched video several times and still don't understand purpose or cause to opposing ui container scene to ui prefabs. i can say only that scene approach could be difficult for team work because scene asset is way less readable and editable in case of merge conflicts, but ui prefabs help incapsulate small changes. and this spagetti code... omg most bizzare use case of preprocessor directives i've ever seen ._.

  • @MaZyYTube

    @MaZyYTube

    Ай бұрын

    The problem with prefabs are sometimes they are constantly changing numbers. Because of LayoutGroup. And you most time then need to overwrite but it can be messy if you have to many and even more if is nested. If you only use in the scene without prefab version you know only the scene needs to be saved not the single prefabs one by one. Also prefabs and nested sometimes numbers a taken from root prefab and sometimes the nested prefab uses numbers. To avoid this he want to use non prefab ui. And yes. I can tell we are little company and I am the UI "designer" in unity. I am almost the one who works on ui while others are programming. We have same problem. We cannot share the work. If both works on scene we have problem with git and merging lol. But this is a general problem. We have the same problem with prefabs and sometimes it hard to to understand the merge conflict. So we decided to keep just one working on the scene or prefabs. Because or prefabs are huge (very UI heavy app). We also have ui scene. We load them and move UI out there to the main scene and close it again. Prefabs gets loaded if needed later.

  • @Dragoncro0wn
    @Dragoncro0wn2 ай бұрын

    Bit offtopic but you have a bunch of canvases for each menu and Unity also recommends using this approach, but In my case adding additional cavases especially nested canvases significantly reduces the game performance. My guess is that you don't have more than 1 canvas active at the same time or something similar? Would be a nice video topic to know when you should add more canvases and when you shouldn't

  • @Unity3dCollege

    @Unity3dCollege

    2 ай бұрын

    None of them are nested, I think that would cause problems of cascading updates. I haven't run into any issues having lots of lightweight small canvases for different UI systems/elements, but also haven't targeted android or VR in a while where the optimization requirements are a bit more intense. The way it's setup though it's an easy swap to make them into groups of panels/etc if needed, but managing them as a separate canvas per thing (abilities, stats, popup text, etc) makes it much easier to keep everything separate (at least for me :)

  • @F0r3v3rT0m0rr0w
    @F0r3v3rT0m0rr0w2 ай бұрын

    Dear gosh you make me want to go back to unity ....

  • @whyabadi
    @whyabadiАй бұрын

    Or switch to the UI Toolkit.

  • @Blind56
    @Blind562 ай бұрын

    it may sound pretty obvious, but if you're scared of prefab overrides then don`t make prefab overrides

  • @Unity3dCollege

    @Unity3dCollege

    2 ай бұрын

    It's not the variants/etc that are the problem, it's when a change gets made in-scene and not applied to the prefab, then another change gets made in another scene and not applied, etc. I know it's manageable, but I've messed it up enough times myself that I prefer to make it idiotproof :)

  • @Octamed

    @Octamed

    2 ай бұрын

    @@Unity3dCollege ah right, I was about to ask what this approach is actually solving.

  • @jackoberto01

    @jackoberto01

    Ай бұрын

    ​@@Unity3dCollegeThe easily solution is to just to only commit files you know you want to change. If I see my scene changed but I didn't do anything other than change a prefab I go override it then discard the scene change. You should already keep your commits quite short and only change a few things.

  • @levayv
    @levayv2 ай бұрын

    Pooled Navmesh problems +1 😂

  • @SLthenus
    @SLthenusАй бұрын

    use multiple canvas is bad, this is told by my teacher