You are really one of the best youtubers on Unity and programming tutorials. Thank you veru much!
@Unity3dCollege6 жыл бұрын
thanks :)
@McNottagoose6 жыл бұрын
This is divine truth.
@ЯрославВальчишен5 жыл бұрын
facts
@--82514 жыл бұрын
@@McNottagoose No, it's not. For true divine intellect go watch Terry Davis instead
@McNottagoose4 жыл бұрын
@@--8251 ha damn thats a grave dig. But I agree, I have since found the truth that is terry davis may his genius soul rest in peace
@melancholerik6 жыл бұрын
This is probably the single most helpful Unity-related channel on KZbin I've found so far. A real hidden gem. I feel like 99% of tutorials encourage just copying the code, without really explaining the thought process. And while the solutions they offer are fine, they're also out of context and not really applicable to even slightly bigger projects - that's how you get those monster classes. When you're trying to get into these things by yourself, those kinds of tutorials do more harm than good in a long run and encourage bad practices. Or maybe it's just a natural thing, doing stuff the wrong way to get started and then learn how to do it properly, I'm not sure. Anyway, I'm really thankful for videos/articles about architecture and programming patterns, you're one of the few people who can explain how these things work and what the benefits are, in a way that I almost instantly get it. Can't thank you enough Jason, your videos have been invaluable and I've learned more in a couple of months than I've learned previously in almost two years. You deserve a lot more views/subs. PS: I have an idea for a video if you don't mind: how about some Unity workflow tips, shortcuts or other fun stuff that you often use when working in the editor? That could be super handy to a lot of people.
@Unity3dCollege6 жыл бұрын
Thanks! That's a great video idea too, will have to figure how to structure it, but I think it'd be worth doing for sure :)
@HippieJavelin995 жыл бұрын
I know that your comment is 10 months old but I feel the same way! It was so hard to find these videos, although I was looking for it. I just didn't know what I'm exactly want to find. It's shame that everyone knows Brackeys content when it's not that helpful (sometimes harming as you said). Anyway, I'm really thankful for your videos Jason!
@punixerz5 жыл бұрын
Yep, totally right. I found this channel via facebook on unity college by luck.
@WhyDoINeedAHandle__6 жыл бұрын
This video and the SOLID principles video should be mandatory for everyone ... not just Unity, but for life in general.
@oatcube39613 жыл бұрын
These videos are awesome. The more flashy Unity KZbinrs like Brackeys and CodeMonkey have very good tutorials also. But the great thing about your tutorials is that you don't just give us a specific way to do one thing, but teach us the principles not only for Unity for coding all together. I believe lot of your viewers are self taught people and the basic principles are the things that the coder easy skips when starting. I have a CharacterAI script in my game that I have been splitting apart a bit to achieve this, but it's still about 600 lines long.
@dknighter26 жыл бұрын
I'll admit I make monster classes all the time. Thank you so much for this, I'll definitely be using composition in the future!
@Unity3dCollege6 жыл бұрын
We've all done it :) I spent years making them before I found the light ;)
@thedude40393 жыл бұрын
I think I just make way too many little classes.
@melodysprout234562 жыл бұрын
the [RequiredComponent(typeof(T))] was EXTREMELY helpful. Thank you!
@imheretosleep2 жыл бұрын
I'm really bad at coding and I'm outta here speechless how lucky I am to find this channel explaining things that saved my motivation in becoming a game developer. Thank you so much good sir! I will do my best to improve and to make a game that everyone will love to play. Once again, thank you!
@AussieRaver19963 жыл бұрын
I love it when you mention something not specific to the video, but you go ahead and explain it. I learnt heaps, thanks!
@DavidBarile5 жыл бұрын
Oh man! You are the programming guru I've always wanted... a true master! Deep understanding of the principles coming from real-world professional experience. You're clear, charismatic as necessary, and cover countless principles that I've only vaguely understood or are completely new to me -- and useful! Thank you so much!
@Zethneralith5 жыл бұрын
It seems to me that the component structure makes more sense if you find it first. I started programming around the time OOP and inheritance were the natural law. I think I'm liking composition for Unity development, but it's taking me a surprising amount of effort to think about it as clearly as I do inheritance.
@davidferguson98752 жыл бұрын
This clearly answered my questions for porting an existing Windows application with heavy class structure to Unity. Brilliant. Thanks Jason. You are doing some good work here.
@Landon_Hughes3 жыл бұрын
You've EASILY become my favorite source to learn more about Unity 😁 Thanks for all the great content! ✊
@maddehaan5 жыл бұрын
This is supporting what I do for some time now, making the object an organic 'disciplines' classes. A. Stats, B. Autonomous, C. Actions, D. Responses, E. Extra (or whatever A,B,C,D,E are needed).
@greglyons2886 жыл бұрын
Thank you for covering this. I am a fan of the composition structure myself, but maybe that's because it's easier for my head to wrap around it.
@Unity3dCollege6 жыл бұрын
Agreed, it makes it much easier to grasp the project
@jerrywalz63086 жыл бұрын
Four minutes into your tutorial, I found what I needed. I just wanted to know how to add inheritance from a Non-Unity C# class into derived classes of Unity so that I could use Inheritance like a normal programmer, else all it is, is a scripting language and that would be a waste. Much appreciation, it is hard to find people who are intuitively insightful to answer our "newbie" questions. public class Humanoids : Monobehavior { } public class EventManager : Humanoids { } So easy but hard to make that bridge with out knowing this.
@Unity3dCollege6 жыл бұрын
Awesome! Glad to hear it was helpful :) Inheritance is an amazing tool to have available.
@bronzekoala91415 жыл бұрын
Probably the single most helpful video I've ever seen when it comes to code design in Unity.
@MaximumSpice Жыл бұрын
Thanks Jason, instead of just the classic, animal, dog/cat example, you used functions and also showed how protected virtual and override is used. Makes so much sense why this is useful or at least time saving! Keen to play around with it and keep improving my code!
@kayronmercieca82265 жыл бұрын
I understand both Inheritance and Composition, but honestly it feels a lot more "natural" to use Composition in the context of programming a game. This is a great video, thank you.
@Alluvian5674 жыл бұрын
Thanks so much for this. Just getting started in Unity (last time I did any REAL programming was in actionscript 3, lol) and this really helped clear my head regarding how to re-use and organize code intelligently. Unity is in many ways pretty similar to the flash IDE actually. Learning to move AWAY from such heavy inheritance that I was being taught back in the day is refreshing.
@0tiii3 жыл бұрын
You can make inheritance follow the solid principles easily if you segregate well. Eg NPC should never have a 'combat' functionality by default since it is supposed to describe a plain living entity, which doesn't necessarily have to be able to fight. If you use OOP and inheritance correctly you will only project the functionality on the classes, that reflect their most basic 'actual form'
@TheBcoolGuy4 жыл бұрын
What about interfaces vs composition in the context of Unity?
@JerryIsdale6 жыл бұрын
Really appreciating your Clean Software Design topics! Composition is a very powerful feature of the Unity Engine. It is a style of ObjectOrientedProgramming that was passed over by most of the mainstream systems. I recall touting it back in 80s for modeling/animation software but not finding good support in languages, etc.
@davidbingham80626 жыл бұрын
This is the video I've always wished someone would make. Thank you!
@Unity3dCollege6 жыл бұрын
you're welcome, and thx for the comment :)
@Hennadii_S2 жыл бұрын
As always - perfect video for learning Unity and coding. Thank You for Your hard work!
@armandoferreira13462 жыл бұрын
on 11:30 it should be a RequireComponent inside the CharacterMovement class, because its the one that needs PlayerInput, the latter does not need CharacterMovement to work.
@filipathtc4 жыл бұрын
One of your most helpful videos for me. Thank you very much!
@guilhermejunqueira65986 жыл бұрын
Great talk. The proper way to use ECS archtecture is definately via Composition. You explained the concept really really well, i would love to see you talk more about SwArchtecture in Unity, subscribed.
@Unity3dCollege6 жыл бұрын
It's been a while since I wrote this, but this method worked last time I tried: unity3d.college/2017/04/24/360-video-in-unity-5-6/
@ruslan_yefimov2 жыл бұрын
I have a fobia of writing spagetti code, so your tutorial really helped) Thanks a lot
@SinusQuell_5 жыл бұрын
Your videos are amazing. Your professional knowledge is so rare on KZbin, and super helpful! Keep it up
@harmoniac.design5 жыл бұрын
So incredibly helpfull and important information, thank you! I was always stuggling how to put things together and I was searching ALOT for this kind of info. This should go into the Unity Coding series!! You learn all sorts of things about what is what, syntax and so on, but a more distant overview about projects, coding in general was missing badly. One thing I'm still missing is the actual input when coding, like shortcuts, comment things out quick, how did you changed the first letter so quick, how to implement a method part when you wrot just the methods call in update and much more. Would mucho appreciate a tutorial or just tell your favorite shortcuts/techniques. Anyway, keep it up! Good stuff! Greetings from Germany
@wadu72055 жыл бұрын
This vid just changed my life. Ty you are doing gods work.
@MohamedAdelQuickDeveloper6 жыл бұрын
I really liked this video, specially at this time, I have been stuck in a project which is a mess. And we need to add a multiplayer mode in it. I think some refactoring would help. Thanks for these videos It helps alot.
@JashJhaveri5 жыл бұрын
just found your channel and i really like the way you approach teaching. Good to find videos more on the design philosophy!
@kpickett91284 жыл бұрын
This is awesome!!! I'm a C# newbie and found this to be a very valuable high-level explanation of how to think about setting up game code. Thank you for making this! Time to go make a bunch of "behavior legos" and build cool things out of them. : D
@lando65834 жыл бұрын
great video! gonna use composition to start cleaning up my 1000 line classes!
@popuzin6 жыл бұрын
I like your videos! Will you continue this playlist by teaching us Design Patterns applied to Unity game programming? I mean not only classical Singleton, Object Pooling and State Machine, but also others like Factory, Adapter ect.?
@Unity3dCollege6 жыл бұрын
Definitely!
@НейтральныйМаппер-з2м3 жыл бұрын
As an Unreal Engine programmer it was interesting video, i've received some decent ideas about architecture in general bc im a noob :D. It was really interesting and helpful, thanks
@yangez934 жыл бұрын
Your tutorials are really helpful, thank you very much Jason
@davidvarga29167 ай бұрын
Guilty as charged. I've worked on my game for a year(on and off). Nearly finished the base game, but realized that the gameplay design was wrong and the complexity of large pieces of codes made me want to push my fingers into my eyes. So I've stopped. Now I've finally redesigned the gameplay after months and all I needed was this. Thanks. I'll start cutting up my code into little pieces.
@Gary1q24 жыл бұрын
yay good video on composition and inheritance with some solid examples!! thank u :D
holy shit.... this is exactly what i was looking for!!! makes some things so much clearer
@LeviAckerman-xt7dx3 жыл бұрын
its beautiful.
@Ninja-Dev2 жыл бұрын
@Jason Weimann Inheritance 0:43 Composition 9:50
@DoomCatcher3 жыл бұрын
Really useful thank you, how do you decide when you should use a component for health or use an interface that "forces" a class to have hp if that makes sense?
@f123-i4d6 жыл бұрын
could you make a video talking on how to manage packets? great videos btw :)
@lizardkamal6 жыл бұрын
I wish I can see you work on a like full project maybe something small with solid principles.
@Unity3dCollege6 жыл бұрын
I'll definitely have to do that sometime soon
@0tiii3 жыл бұрын
I feel one of the mein backdraws of being able to use inheritance well in Unity is their totally sucky default serializer.
@DustVoltrage5 жыл бұрын
I've always felt like the unity component system was screaming for composition and make it extremely easy to manage ! The only time I dealt a lot with inheritance was for my rpg equipment/inventory system and it was much more complicated...
@baroquedub6 жыл бұрын
Thanks for another brilliant video. I wish I had the money to do your courses, they're sadly out of my price range, but I'm very grateful that you give so much of your expertise for free on KZbin :) Can I ask... with composition is there a way to know or enforce the order in which the various components are acted on? Does the order in the Inspector make any difference? I know about Script Execution Order Settings but I can see this getting very convoluted on a large project with multiple scenes. I guess there's also the option of choosing carefully between initialising things in Awake() or Start(). Just wondered if you had any tricks or recommendations for this?
@abaddondestroyer11245 жыл бұрын
Can you maybe start a series of making a RPG game - you know because of the complexity of how most classical RPG's work (but not as complex as an MMO) and also make it 2D for simplicity sake - The point being is - you are full with knowledge and if we would have such a series, we would learn first hand from you design patterns, best practices, real life solutions in specific scenarios.. damn make it on udemy if you like - shut up and just take my money (I am kidding - don't shut up keep it comming) :)!
@northstar79786 жыл бұрын
one step further is using scriptable objects for adding functionality to gameobjects. maybe you should talk about it sometime?
@williamedwards39115 жыл бұрын
Thanks for this tutorial - really helpful
@Aye_Sid2 жыл бұрын
Thanks for the video sir. 😀👍🏻
@bobsignori90245 жыл бұрын
By the 12:50 you talk about events... It can be used that idea in a multiplayer project? Like, classes inheritance and events? If so, do you have something like that more specific?
@neozoid70092 жыл бұрын
Awesome tips thanks
@rafa_guitar6 жыл бұрын
Very useful! You help a lot, thanks!
@lvx9695 жыл бұрын
I tend to use a combo of both.
@sunflowerchocolates6 жыл бұрын
Nice, thanks for all these tutorials! Can you create a tutorial on a bubble burst games? Like when you click on the bubble, it pops. I'm trying to do this, but can't figure out how to switch back from a bubble image --> popped image with the prefabs and animations I've created.
@haakon0234 жыл бұрын
Hey, I am curious, would you prefer a public static event OnDied in the health class or having the pooling system actually have a reference to health Component?
hi would it be possible for you to show us how to create a boxing 12 round system with cut scenes between rounds please .
@SealDev4 жыл бұрын
Thanks for this :) Very useful!
@sconosciutosconosciuto21965 жыл бұрын
I've a doubt.. If I have a script that manages weapon firing... If I have a weapon that fire 1 bullet once and another that fire 3 with different angulation.. Is better to do a inheritance (do another script that change the base class), or composition, so i do one script for firing like the first case, another for the second?
@sconosciutosconosciuto21965 жыл бұрын
I also want to do a system where there are some weapons that need charging before firing the first bullet (like a minigun) and others not.. In your opinion is better composition or inheritance? (Sorry for stupids questions)
@sconosciutosconosciuto21965 жыл бұрын
(For the last questiob) I want to do composition but I don't know how to do that if there is the component, before firing, the weapon need to wait.. Should I use event (I can't use them)?
@Rhino10045 жыл бұрын
@@sconosciutosconosciuto2196 Ever seen that video called, "Ability System with ScriptableObjects"? You should consider adding methods to a 'Bullet' ScriptableObject that your weapon can use. Then, make an SO that inherits from Bullet, call it something like 'SplitBullet', give it a different Fire() method, and you're good.
@kiyasuihito4 жыл бұрын
Very nice tutorial. It just seems weird to inherit from monobehaviour when a class doesn't need its functionality, like in your health class. Maybe I'm thinking about it wrong...
@Killer_Nads6 жыл бұрын
Thats great thanks! Ill go with composition from now on, it seems much easier to write and also to maintain!! Just a question after using the composition Health class, how do you access its TakeDamage() method from another class? Would it be the same thing as inheritance? ie. you have to first find the object by tag and then use "npc = GetComponent" and then use "npc.takeDamage" ?? or is there another better way to do it? thanks
@beaverjoe91715 жыл бұрын
FindTypeOfObject()???? He offered some reference to catch GameObject
@dicousdev25922 жыл бұрын
You can use an interface in the Health class and receive hits from enemies by accessing the class, regardless of who it is, the Observer pattern will be executed
@slam2pan3 жыл бұрын
What keyboard are you using?
@dango_30166 жыл бұрын
I'm composing a lot of scripts in my current project by having a Manager class that decides when to use which script: for example disabling and enabling different camera or movement scripts. Do you think this is a good method or inefficient somehow?
@mrvastayan2 жыл бұрын
Would I be correct in saying that the proper syntax today for on died would be OnDied?.Invoke();
@krissloo1434 жыл бұрын
that moment when you realize you've been using composition the whole time xD
@xatov21382 жыл бұрын
You are the B E S T ! With dark mode it might be even better 🤣
@foncode1012 жыл бұрын
You da man!
@MisterMashu6 жыл бұрын
happy times
@juts896 жыл бұрын
Registration is showing closed on the linked course, FYI
@Unity3dCollege6 жыл бұрын
Thanks for letting me know, just fixed the link :)
@Danyu914 жыл бұрын
Why did you have to call base. Update()? I thought the override keyword was supposed to let you have different "Update()"s from the base class.
@tomwhitcombe76214 жыл бұрын
it does, but there may be common stuff in the base class you want to call as well. One of the problems is knowing when this is a must to not break stuff or not.
@Danyu914 жыл бұрын
so, if you call base.Update(), it will call whatever is in the base class Update, but if you just call the override Update(), with custom functions, it will do the custom functions?
@bigjamar5 жыл бұрын
Muchas gracias..!!..excelente..!!
@soyfandev49255 жыл бұрын
thank u sir
@latbat585 жыл бұрын
isnt this really similar to single responsibility principle or am i missing something? sry i suck at codin stuff
@idle.observer Жыл бұрын
But you can use Composition and Inheritance together.
@CabinIcarus6 жыл бұрын
This is like the ECS.
@Aladato6 жыл бұрын
I never really liked Inheritance, while on the other hand, Composition immediately clicked with me!
@Ziplock90005 жыл бұрын
more messy and less performance by far for cross calls
@Scottx125Productions5 жыл бұрын
I'm the opposite, I prefer inheritance. Clear line of hierarchy with classes. You don't end up mixing and matching making it much easier to follow the code.
@Zethneralith5 жыл бұрын
@@Scottx125Productions I'm in the same boat as you. Inheritance just makes more sense to me. But I'm finding that it has problems when we don't know the full scope of our application from the start, which can lead to a great deal of refactoring. It seems easier to follow single-responsibility when using components, so I'm starting to like components more. It does seem that Unity prefers this approach, as well, but it's difficult for me to switch my brain over from inheritance to composition.
@MoonLiteNite4 жыл бұрын
@7:55 this is me...
@thedude40393 жыл бұрын
9:00 In fact, let's umm, watch all the movies you want for one low price.
@Skiggles2 жыл бұрын
I think what annoys me about the whole component system is that in your example and many others, these components still depend on one another. CharacterMovement still needs the NavMeshAgent and is useless without it. This is not a criticism of your design, but rather this idea that "you can mix and match components and it just works" but you really cannot in many cases because they usually need to communicate in some way.
@keyboard18194 жыл бұрын
I understood a thing after this..... My code really sucks
@XtroTheArctic5 жыл бұрын
I love your videos but the OnDied event name is horrible :) Event names should be Verb-ed only, like Died, Closed, Shown. OnXXX format is used for override(virtual) methods only :)
@sconosciutosconosciuto21965 жыл бұрын
So inheritance is useless
@Dxpress_5 жыл бұрын
Not at all.
@Pspet5 жыл бұрын
- starts showing an inheritance design - continues to mess up the inheritance design - points out that inheritance doesn't work well Lol, if you want to have a Merchant in your design it should not inherit directly from your NPC class. Inside the NPC class you have some combat logic, not all NPC's do combat. Instead you should have a CombatNPC class that inherits from the NPC and put the combat logic there. This way, the Merchant could inherit from the NPC correctly with no problem at all.
@TheBendixSA4 жыл бұрын
Until you want to add a special merchant that can do combat. Then you're fucked
@user-lv6qm3fj2z5 жыл бұрын
The composition approach looks too heavy - 3 components on each character instead of 1 is a fuck up.
@markcooke48663 жыл бұрын
Using unity components is only one approach to composition. You could also just use class composition instead to separate concerns.