Thank you for this tutorial. In a way, we can replace interfaces with scriptableObjects. What is the best method in your opinion?
@ThomasBCharlie3 жыл бұрын
As a self-taught programmer and game dev enthusiast I find that nearly all Unity tutorials completely gloss over any semblance of proper design patterns. They cock up quick scripts that do what their title says in sub-optimal ways and are impossible to expand and build upon. For years, such tutorials have been teaching me to haphazardly connect various Unity components and just hope for the best, and as a result I continue to rewrite my code over and over while struggling to make anything more complicated than the simplest Space Invaders knock off. Nowadays, I find these kinds of tutorials that actually talk about how code is written in in general much more useful than anything else. Being set in Unity helps a lot too, cause I'm not familiar with many frameworks outside of that. Thank you.
@HATL2012 жыл бұрын
That's comparing apples to oranges. Most of the Unity tutorials on youtube are teaching you how to implement a certain game logic. And yes, they should be quick and concise, telling you exactly how to implement that logic and be done with it. On the other hand, code design patterns, principles and practices is a separate domain, and it's the responsibility of the user to learn them as well as the game logic on their own.
@buriedomasta33752 жыл бұрын
@@HATL201 where do I start from? I am a beginner
@nuin99 Жыл бұрын
@@buriedomasta3375 how did it go
@beardordie53085 жыл бұрын
For those struggling to use the selection manager outside of this or any project with it already working, here's a hard-earned tip: make sure your camera has a Physics Raycaster component on it.
@InfallibleCode5 жыл бұрын
Thanks for sharing this! I definitely glossed over this very important detail lol
@gadgetboyplaysmc4 жыл бұрын
Go up and save the day you foo! LIKES LIKES LIEKS!!!
@potatomilk74004 жыл бұрын
and tag said camera as Main Camera. I almost had an aneurysm trying to figure out why it wouldn't work for me.
@al20ov874 жыл бұрын
I don't have that on my camera and it still works fine
@kidsteveee5 жыл бұрын
Oh man, we need more tutorials like this.
@InfallibleCode5 жыл бұрын
More content is in the works! Stay tuned! :D
@TheGuyWithTheLemon5 жыл бұрын
Dude this is a great tutorial! Finally, a channel that goes in-depth into core coding principles that every game programmer should be following! Coming from a coding background this level of detail is perfect!
@THEspindoctor843 жыл бұрын
I didn't really get it, until I saw you swap out one script for the other at the end. Then it clicked...mostly. such a great video, and the production value is off the charts and very much appreciated
@gadgetboyplaysmc4 жыл бұрын
I have not even watched the video in full and I'm fucking mindblown.
@KHam564 жыл бұрын
I much preferred this teaching style of your videos over the mock conversations of the current videos. its faster to the content without the bloat of expression, "story building" filler moments like showing off gameplay, and the greeting conversation. time is precious and videos like this feel much more efficient and attention holding.
@JackEatock3 жыл бұрын
As a student, I can't explain how useful your videos are at improving my code. Love your channel!
@n8dev3 жыл бұрын
honestly this is the most helpful tutorial I have ever watched
@InfallibleCode3 жыл бұрын
Wow I really appreciate that!
@n8dev3 жыл бұрын
@@InfallibleCode wow that was quick, I appreciate you making these tutorials so much! I am going to link your video on namespaces in my next devlog, it helped me organize my project really well. With Brackeys gone, I can see you blowing up as much as he did :)
@InfallibleCode3 жыл бұрын
@@n8dev I'm just glad that my videos are helpful, that's the most important thing :D
@dotaportalvideo4 жыл бұрын
Was not expecting to become a better coder while looking at Unity tutorials today. Nice work.
@NeoDragonEWW5 жыл бұрын
I love your tutorials. I like that you take on slightly advanced programming topics, show them in a real-world scenarios/use cases, and explain why the topic makes sense - eg. this video on the SOLID ideas that a lot of teams use.
@InfallibleCode5 жыл бұрын
So glad you found it helpful! I really like tackling these advanced topics because their so important and aren't covered very often.
@tapoutluke3 жыл бұрын
Thanks for the video! This helped me make a WeaponManager class allowing for different weapon behaviors :D
@snook55555 жыл бұрын
Love code quality tutorials, it's an area I'm always looking to improve in
@andrewshandle5 жыл бұрын
Fantastic tutorial. When working in the corporate world, I always try and teach the SOLID principles to developers from day one. There's nothing more demoralizing then coming across legacy code with a 12,000 line method in a class that does 37 things and nobody knows how it works. ;)
@donnyjoe76532 жыл бұрын
I like how you genuinely want to inform us about green being your favorite color, in a subtle side note 14:04 :D. Thanks for the great content!
@mayankbhaisora26992 жыл бұрын
Came across your channel a couple of days ago and it’s one of my favourite gamedev channels. Your tutorial easy to understand and you explain everything properly like the real problem, options, solutions. Great work man. Keep helping people like me.. thanks
@krisitak5 жыл бұрын
In this case, instead of interfaces, I'd use abstract classes that inherit from MonoBehaviour. That way you won't have to assume something IS A MonoBehaviour that IMPLEMENTS an interface. Also, some assertions to lock these invariants. Great video, nice editing.
@BrokenPuzzle033 жыл бұрын
You have taught me more than my 4 years in University
@InfallibleCode3 жыл бұрын
Wow! That's amazing to hear :D
@MaddinUndSo3 жыл бұрын
this might bring a little bit more organization in my coding. thank you very much!
@themerpheus5 жыл бұрын
Wonderful. Simply wonderful. Good explanation for those of who don't know SOLID principles.
@ScilexGuitar4 жыл бұрын
Im a beginner and I have no idea what is going on. Maybe I will in a few years. Saving this vid :D
@018FLP2 жыл бұрын
What a relief! I'm an absolute code beginner, so it's easier for me to separate everything for debugging so i naturally code using something very close to this principle. Though i was dumb for making extra steps, but it's very cool to see this is a good practice. Nice!
@newpractice4 жыл бұрын
this explanation of how scripts should interact with each has been just what I needed, thank you
@orinom41283 жыл бұрын
Your cats tail at the start made me think I had a spider on my screen and i proceeded to spend the next 3 minutes trying to find the spider in my phone
@lightiichen4 жыл бұрын
This REALLY helps a lot as I'm just getting in designing my own game structure but not able to find a tutorial like this. KEEP IT UP BRO!!!!!!
@shoco24 жыл бұрын
Honestly don't know another channel that explains everything so clearly and understandable, great video man
@Walter58502 жыл бұрын
Brilliant! I have been getting back to this video for quite some time, but I just wasn't ready to comprehend the ideas due to lack of knowledge. After reading about SOLID principles on my own and looking through some examples, I was able to familiarize myself with the core ideas. Afterwards, it was far easier to follow the video and I was able to learn much more from watching it.
@KasperSOlesen4 жыл бұрын
All the SOLID principles explained and used in 15 minutes :) Good job.
@sparrowhawk815 жыл бұрын
Interfaces are nice. A dev partner and I have been working on a simple 2D shmup for about 1.5 years now (we are taking our time). It came in handy for a lot of stuff. We have interfaces like IProjectile that make it so that all our different types of projectiles HAVE to have a damage value, speed, lifetime, etc etc etc. It also comes in handy when using Zenject, which we do ;-)
@InfallibleCode5 жыл бұрын
Good stuff! I always love to hear about practical examples of OOP concepts being applied in game development.
@Bergquist3D5 жыл бұрын
Awesome video! I would love to see this turned into Pure ECS!!
@bgildersleeve5 жыл бұрын
Excellent tutorial. It's great to see videos like this that emphasize clean code principles!
@lando65834 жыл бұрын
great tutorial. the community needs more videos like this.
@Brian-vs9sd5 жыл бұрын
Wow. This is an excellent tutorial on the SOLID principles. The example you used was so relevant not just to game programming but programming in general. Well OOP anyway.
@InfallibleCode5 жыл бұрын
I draw on years of experience building enterprise applications when I work on these tutorials. Some people think that those two worlds wouldn't mix but there's plenty of overlap between business and game development. Software is software at the end of the day.
@myscipper3 жыл бұрын
It's so beautyful :)
@Osybear5 жыл бұрын
Thanks for concise tutorial. Keep it up man!
@NorthernlionLP2 жыл бұрын
Decent video, using so many IDE options instead of just copy-pasting was slightly infuriating tho :p
@endorphingames29572 жыл бұрын
Yes make it more complicated looking at specific IDE functionality rather than copy paste
@monkeyrobotsinc.98754 жыл бұрын
yep. green is a great color.
@BigDaddyGameDev Жыл бұрын
Great video! So many tutorials ignore good programming principles. I have a few bad habits to break.
@CCV3345 жыл бұрын
This is exactly what I've been looking for. Thank you so much for the clear and concise example!
@georgew.82823 жыл бұрын
That was one of the most enlightening tutorials I have ever seen. Thank you very much for this!
@blasder0074 жыл бұрын
amazing tutorial, i like how this is just at the level that i am at programming so i can understand everything , thanks!
@android2725 жыл бұрын
Thanks for this. I will be using this in my game. I have a class that is equivalent to your selection manager that does way more than what your class did at the beginning of the video. I have a lot of refactoring to do :)
@Ohlawdie5 жыл бұрын
Quick, cool, informative - as always Charles! Cheers, much obliged.
5 жыл бұрын
Tip for clean code : event handlers should call a function, but not contain implementation. You want to have a quick look at it and understand what is going on, not read throguh the whole event.
@orc_spearman5 жыл бұрын
Very good and easy to understand example, good job and thanks
@vasikplays88004 жыл бұрын
Hey new subscriber here. Thank you so much. Please keep doing these videos.
@modernkennnern4 жыл бұрын
This feels a lot like a Ryder ad :P Really good tutorial though. Certainly got me thinking
@mana205 жыл бұрын
Great video, looking forward to more architecture related videos. You should do a series on Event architecture(delgates, events, actions, func) to decouple code.
@RenatVasetskyi Жыл бұрын
good video, I often have crowded classes that are difficult to expand, fater this video i will try to do everything clearly
@funkyjedi5 жыл бұрын
Brilliant and clear, thank you, looking forward to more in the series.
@ananttheant4 жыл бұрын
Thanks for your content, you are my go-to unity related programming Feed!!
@-Engineering01-2 жыл бұрын
I think this is a double edged knife. We use these patterns to make the code look more readable but at the same time we're over engineering the code with lot of classes especially for a small hyper casual game where at these patterns maybe never needed.
@wearwolf42022 жыл бұрын
Your pop up literly was in the way of me seeing what you were doing.... thanks
@AethernaLuxen4 жыл бұрын
Great tutorial! Btw, captions are broken
@hematogen50g4 жыл бұрын
You got my subscription, man!
@InfallibleCode4 жыл бұрын
Awesome, thank you!
@hematogen50g4 жыл бұрын
@@InfallibleCode Got to complete test assignment for Unity programmer job. your channel really helps.
@revraitah4 жыл бұрын
Pretty cool and useful tutorial. Keep it up!❤️
@Sindrijo5 жыл бұрын
Not that it is important to the lessons shown in this video but you could derive from Unitys IPointerEnterHandler and IPointerExitHandler interfaces (in the UnityEngine.EventSystems) instead of implementing your own raycaster. (Note that you do need to add a Physics Raycaster component to your Camera object for it to work, which I saw another comment mentioning but is actually not needed since the code in the video is doing its own raycast.)
@Yulaw2k5 жыл бұрын
Please make more videos like THIS. Do it again with example 2, then example 3. You got alot of views on this. If you check out your spatialOS videos....not many views.... We appreciate your skills as a coder more then you dabbling into the "new".
@InfallibleCode5 жыл бұрын
Haha don’t worry more videos like THIS are definitely on the way. Only one more video left in the SpatialOS series so stay tuned to the channel.
@Yulaw2k5 жыл бұрын
@@InfallibleCode "Celebrates"
@myriampaolachangoluisatoap31004 жыл бұрын
Hello, could you post the link of the outline assets you are using? I got 2 errors related to outline script.
@atakankuloglu48772 жыл бұрын
Perfect explanation. Thank you for sharing your knowledge with the community!
@Daedhal3 жыл бұрын
WHAT ABOUT ADDING A LINK TO THE ASSET USED FOR OUTLINE ?? Edit: After searching for a while, here is the asset used in the video assetstore.unity.com/packages/tools/particles-effects/quick-outline-115488
@turin23 жыл бұрын
Very much appreciated , thanks!
@d11men12342 жыл бұрын
Thank you very much dude
@michailmarkou19952 жыл бұрын
amazing tutorial!
@rutulthakkar92893 жыл бұрын
how is the tag being referenced in the new classes you created from the selectionManager ?
@daniilparokonnyy79805 жыл бұрын
So useful! Thanks a lot!
@InfallibleCode5 жыл бұрын
Glad you found it useful!
@mehmetoguzyardimci85984 жыл бұрын
Quality content!
@alpho943 жыл бұрын
Great video, but I have a question: it appears how in the update method of the SelectionManager you are first deselecting the object and then, if the raycast hit the object, put the selection back in the same frame. Wouldn't be better to put the select and deleselct methods in a if else statement, checking before the value of the raycast, so that you don't run both and save performance? also since those methods do the same thing, they could be unified by creating a single method which change the material or a value in the case of the outline, as taking it as input paramenter.
@TheNamesJT4 жыл бұрын
This is a bit out of my scope of c#, i have an idea though it would be nice if you made a c# basics and intermediate series but to stand out from all the other youtube videos that do this you could make the video like you did in your "Unity Events in Action" and "C# Events in Unity" videos. I like how you incorporated problem solving while also teach code in a in game project. Many many youtube c# series just teach you the basic syntax and read the definition from the documentation and don't show in game examples.
@JJordanov9454 жыл бұрын
Is there any way we can use both Highlight and Outline Selection Responses simultaneously? I've been playing around with it but as you've mentioned in the vid you have to remove one to place the other. I want to know if I could make a third Response class, say InteractiveSelectionResponse, which is responsible for handling mouse input when you press on a selected object, while still making use of the HighlightSelectionResponse component for visual feedback.
@darkman2373 жыл бұрын
What about using c# events to decouple the code?
@endorphingames29572 жыл бұрын
Yes, I would have a script on each object with the functionality of changing its own material. Selection manager would only sent events on raycast.
@prudhvi92564 жыл бұрын
thanks for the tutorial, it would have been great if you only used 2/4 of your objects to use the new green highlight methods while having the others still swap to yellow, if that is instead of it would have worked.
@romeogaming64244 жыл бұрын
Excelent, thanks!
@klarnorbert4 жыл бұрын
I'm here for the cat.
@jeffng504 жыл бұрын
I have a few questions: 1. How does the concrete SelectionResponse seep into the code as it just initialises ISelectionResponse the interface? 2. What if I want both effect to manifest? Highlight and outline together?
@chrisgreenwell34045 жыл бұрын
Really great , thank you :)
@lunkums3 жыл бұрын
Hi! awesome tutorial you've created, but i have one question. What is the difference between the deselect and select code bodies? They look identical
@lunkums3 жыл бұрын
nevermind, i didn't see that deselect was default mat and select was highlight mat. Thank you
@abwuds72085 жыл бұрын
Great job! Quick question though, why don't you have a Rider warning for the serialized + private fields that don't begin with an underscore?
@vilinder4 жыл бұрын
I am confused, is the downloadable project one before or after the refactoring is done?
@ZoidbergForPresident5 жыл бұрын
Quickie: we could use a List, right? To get outline AND highlight?
@MatheusAugustoGames3 жыл бұрын
I think instead of LSP, you used DIP at around 8:08. I could be wrong.
@thebulletkin839311 ай бұрын
After just getting into Unity it’s been an absolute pain learning how to structure everything, it feels completely different given it’s component system, and I feel it’s going to take ages to clean up my stuff to be of a decent quality
@madey16853 жыл бұрын
How to change _selectionResponse value at runtime?
@dickyerlangga74734 жыл бұрын
thanks for the video, i have followed the instructions based on the video. but i have problem with this error 'The type or namespace "Outline" could not be found (are you missing a using directive or an assembly reference?)'. how to fix it? thanks
@mrduby34644 жыл бұрын
Did you make sure to actually download the Outline pack he said he got off the store? Outline isn’t a native component to Unity so unless you got the same asset off the store Unity has no idea what that is.
@shadmansudipto72874 жыл бұрын
What's the "set by unity" thing?
@Robbin_Bob2 жыл бұрын
probably a bit late to this but that syntax highlighting theme you have is amazing, what setup do you have?
@N0biKn0bi4 жыл бұрын
why do you name some variables with an _ at the beginning?
@mrslake70963 жыл бұрын
for prototypes or small projects, I think these principles can be overdone , which means you reduce your productivity & increase code complexity. But I can see how they can be very helpful for larger projects or long term projects
@Yulaw2k5 жыл бұрын
What about putting any ISelectionResponse as a scriptable Object. Since its only being used by the SelectionManager. You know how an scene object can have alot of components attached to it. Instead of adding another one script to the object, you can drag the selection behavior onto the script using it. Is this a good, or bad idea?
@piotrw33665 жыл бұрын
Hi Charles! Great video! Is making monobehaviour uicontroller an interface a good idea? I wanted to make an interface out of it so maybe pc has different UI than mobile game but if they use the same interface I could just find the interface in Game Manager class and use whatever UI type I get. But can't find a good way to find my UI interface beside var ui = FindObjectsOfType().OfType(). Do you think it's a good way to do it? Thanks!
@piotrw33665 жыл бұрын
Hi Charles! Sorry to bother you but after asking the question I came up with a solution. I get a public GameObject to the uicontroller monobehaviour and use on it GetComponent instead of looping through all the monobehaviour. Do you think it's a good workaround? Thanks!
@josephdaniel2354 жыл бұрын
Hello, I know this code is a year old but does this follow the same logic as the one previous? I only ask because the previous code is completely different in this video.
@asafalroy21593 жыл бұрын
Great tutorial! I have a question though, what would you do if you'd want to combine the two behaviors of the selection responses together, so everytime you hover over a GameObject you'd want to highlight /and/ outline it? Thanks!
@rohith6xt3 жыл бұрын
Does raycast work in augmentation reality
@Laure2full4 жыл бұрын
The code is difrent thant it was last ep did you change it and why?
@happyfarang5 жыл бұрын
Great video. Very solid info. I just wonder, what if you want to make the response conditional, f.ex say, if you looking north make them yellow, if not then use the green outline. Something like that. You would have to make a new class with both interfaces? or am i missing something obvious here? :) I will have to watch this a few times
@InfallibleCode5 жыл бұрын
If you wanted to response to be conditional then you could apply the Null Object pattern. But if you wanted to implement more sophisticated behavior then you'd need to implement a new class to handle it. Does that make sense?
@happyfarang5 жыл бұрын
@@InfallibleCode Makes total sense :) I think i understand it! I will try to make my own test. I like this pattern. The "kind of generic" approach hehe.
@Devinci2973 жыл бұрын
You look like Cmdr William Riker from Star Trek Next Gen!
@InfallibleCode3 жыл бұрын
Hah that’s awesome!
@starbuck39802 жыл бұрын
But actually how would be using the Liskov substitution principle? as you use other class with the same method names but actually the functionality changes, and the principle says functionality must not change
@omeryilmaz1021 Жыл бұрын
you do run OnSelect() and OnDeselect() method at the sametime when mouse enters on "Selectable" object, what s the point of that?
@Tofos943 жыл бұрын
i started unity 1 year ago and i tried this tutorial last year. I didnt understand anything :D maaan now i see how messy my code actually is. As a software engineering student in 2. semester i just learned how to code object oriented and with an mvc principle but i feel i cant use these methods in unity/c#
@manolov40744 жыл бұрын
what is the code editor being used ?
@manolov40744 жыл бұрын
FOUND IT IT IS JET BRAINS RIDER ! :)
@magnusm44 жыл бұрын
The problem I have is I try to make my own physics, sort of. I try to make everything come down to one vector3 mainMovement. Then other methods such as SlopeDifference use transform.forward and input. It becomes a cluster**** of variables they use that is shared and changed through the entire script.