I absolutely love your tutorials, it's like getting 1 year of experience in less than 20 minutes. I'm very much using null values as a caveman right now as I tried using the nullables from C# with Unity but ran into all kinds of weird problems like having to have preprocessor directives all over the place and I think in the end it didn't even work so I just gave up. Coming from JS I sorely miss the ?. syntax which I'm still not sure how much it's supported or not in C# and Unity. Like Unity objects say not to do it, though it seems to work most of the time. These are really interesting techniques, especially getting two types out of a statically typed language in a clean way was something I always struggled with. Keep it up man, your videos are packed with insane value
Thanks for the awesome comment! Nulls with UntiyEngine.Object are a pain, especially with null coalescing operators. Check out the extension method we created to handle this, about 1/2 way through this video here: th-cam.com/video/Nk49EUf7yyU/w-d-xo.html The 'OrNull' extension method is in the Utility Library link in description. Cheers!
so true - it's always something new for me even with my 13+ years of experience. I really wonder where he gets his resourcen from. You can't tell me he is doing all those nify patterns and paradigms at regular work!
It was just last week that I had to bang my head against a brick wall to make Option myself lol. nice vid. Options are far better than they are given credit for
Honestly, I've not been this excited to see a new upload since Brackeys, and I mean no disrespect towards Brackeys but I think your videos are so much more valuable and informative. I think you should keep making these informative/introductive, more isolated video explanations and demonstrations, but have you considered also making a series of sorts, short courses which span over a few videos, utilising several of the concepts and patterns you've made videos of in the past, to show the workflow and thought-process of how to tie things together? There's plenty of code-alongs and "how to make " out there, but I think the majority of them are detrimental even. There's been so many videos, especially when I was first starting out, that just left me more confused and feeling less knowledgeable than when I first started watching them, because they would keep introducing new terms, concept and patterns without properly teaching you the tools but just followed the "just-trust-me-bro-programming-pattern" (totally not a term I just made up). I honestly think your videos should even be sponsored/featured in the tutorial section of the Unity hub. It'd definitely be more planning and effort to make a tutorial-project, so I wouldn't blame you if you feel that it's too much of an undertaking, but I do believe that it'd be amongst, if not *the* most useful and informative learning sources for Unity available. (You also have a really good voice so it's easy to stay focused and listen!)
I haven’t tried it myself, but it might be possible to create a functional, chainable API that mimics LINQ while remaining DOTS-compliant, which might help safely manage and transform data within ECS systems. I think it might have to be quite a bit more involved than what's presented in this video, however.
The concept of FP Monad doesn't really touch me, do you have any books to recommend? I understood the basic concept, but I think I need an example as well.
In my inventory I declare the Null item as a type of Item (learned from Zoran's videos), and store it as a static field public record Item(int Id, ...) { public static NoItem NoItem = new(); }; public record NoItem : Item { public NoItem() : base(-1, ...) { } }
Sounds just like the Null Object pattern, and a great way to keep things safe and predictable. I think that is so much better than using null values. I like the use of record too. Honestly, I think the pattern is underrated. I really like Zoran's channel, it's probably the best C# channel on TH-cam.
Unfortunately, Nullable doesn’t provide a functional way to handle computations with missing values. That’s where Monads like Optional and Either come in, offering powerful tools to safely chain operations and manage both missing values and branching logic.
@@git-amend so I've been looking closer at this and i dont remember seeing it in your video here but you can enable nullable in the .csproj file. This ensures that everything is non-nullable ensuring that any use of nullabe types are the only explicit times something can be null enable
That's true, but I believe that Unity regenerates .csproj and removes this line every time it compiles. This is also why you can't set the C# version this way.
@@git-amendah.. that sucks. Though i saw you can add it to a setting in unity6 somewhere but then the issue is that unity's code is not implemented with this feature in mind giving you a thousand+ warnings
All this "nullable" stuff makes not very much sense since UnityEngine.Object has perverted null comparison and a non-null reference still can throw NullReferenceException.
Happy Sunday! Hit the LIKE button if you learn something new today! 👍
Keep hitting that like button, since i learn somthing every Sunday. Thanks!
Nice! You're welcome!
With this kind of tutorial, pressing like is so cheap price, keep it up sensei
I absolutely love your tutorials, it's like getting 1 year of experience in less than 20 minutes.
I'm very much using null values as a caveman right now as I tried using the nullables from C# with Unity but ran into all kinds of weird problems like having to have preprocessor directives all over the place and I think in the end it didn't even work so I just gave up.
Coming from JS I sorely miss the ?. syntax which I'm still not sure how much it's supported or not in C# and Unity. Like Unity objects say not to do it, though it seems to work most of the time.
These are really interesting techniques, especially getting two types out of a statically typed language in a clean way was something I always struggled with.
Keep it up man, your videos are packed with insane value
Thanks for the awesome comment! Nulls with UntiyEngine.Object are a pain, especially with null coalescing operators. Check out the extension method we created to handle this, about 1/2 way through this video here: th-cam.com/video/Nk49EUf7yyU/w-d-xo.html
The 'OrNull' extension method is in the Utility Library link in description. Cheers!
so true - it's always something new for me even with my 13+ years of experience. I really wonder where he gets his resourcen from. You can't tell me he is doing all those nify patterns and paradigms at regular work!
It was just last week that I had to bang my head against a brick wall to make Option myself lol.
nice vid.
Options are far better than they are given credit for
Nice, I agree!
Honestly, I've not been this excited to see a new upload since Brackeys, and I mean no disrespect towards Brackeys but I think your videos are so much more valuable and informative.
I think you should keep making these informative/introductive, more isolated video explanations and demonstrations, but have you considered also making a series of sorts, short courses which span over a few videos, utilising several of the concepts and patterns you've made videos of in the past, to show the workflow and thought-process of how to tie things together?
There's plenty of code-alongs and "how to make " out there, but I think the majority of them are detrimental even. There's been so many videos, especially when I was first starting out, that just left me more confused and feeling less knowledgeable than when I first started watching them, because they would keep introducing new terms, concept and patterns without properly teaching you the tools but just followed the "just-trust-me-bro-programming-pattern" (totally not a term I just made up).
I honestly think your videos should even be sponsored/featured in the tutorial section of the Unity hub.
It'd definitely be more planning and effort to make a tutorial-project, so I wouldn't blame you if you feel that it's too much of an undertaking, but I do believe that it'd be amongst, if not *the* most useful and informative learning sources for Unity available. (You also have a really good voice so it's easy to stay focused and listen!)
I'd like to add that a Monad is a monoid in the category of endofunctors
Thanks for sharing another great introduction tutorial.
My pleasure!
Interesting. Could this be used to implement Linq-like functionality on Native Collections within DOTS/ECS (since Linq does not work within DOTS)?
I haven’t tried it myself, but it might be possible to create a functional, chainable API that mimics LINQ while remaining DOTS-compliant, which might help safely manage and transform data within ECS systems. I think it might have to be quite a bit more involved than what's presented in this video, however.
@@git-amend yeah I figured it would be involved but seems like a good starting point 😊
Java's optional was a game changer when it was introduced.
Indeed. It seems like C# is always a little behind on these kinds of things.
Optional.ofNullable().orelse() was the best thing ever happened
The concept of FP Monad doesn't really touch me, do you have any books to recommend?
I understood the basic concept, but I think I need an example as well.
Sure, you can read more here. The Maybe Monad is similar to Optional. softwarepatternslexicon.com/patterns-c-sharp/7/10/
Your tutorials are masterclass quality, thanks.
You're very welcome!
i have java background, I LOVE nullables.
Haha! 💯
In my inventory I declare the Null item as a type of Item (learned from Zoran's videos), and store it as a static field
public record Item(int Id, ...) { public static NoItem NoItem = new(); };
public record NoItem : Item { public NoItem() : base(-1, ...) { } }
Sounds just like the Null Object pattern, and a great way to keep things safe and predictable. I think that is so much better than using null values. I like the use of record too. Honestly, I think the pattern is underrated. I really like Zoran's channel, it's probably the best C# channel on TH-cam.
I like the idea of null object that do nothing, but im not too sure about making non-nullable types nullable
Unfortunately, Nullable doesn’t provide a functional way to handle computations with missing values. That’s where Monads like Optional and Either come in, offering powerful tools to safely chain operations and manage both missing values and branching logic.
@@git-amend so I've been looking closer at this and i dont remember seeing it in your video here but you can enable nullable in the .csproj file. This ensures that everything is non-nullable ensuring that any use of nullabe types are the only explicit times something can be null
enable
That's true, but I believe that Unity regenerates .csproj and removes this line every time it compiles. This is also why you can't set the C# version this way.
@@git-amendah.. that sucks. Though i saw you can add it to a setting in unity6 somewhere but then the issue is that unity's code is not implemented with this feature in mind giving you a thousand+ warnings
All this "nullable" stuff makes not very much sense since UnityEngine.Object has perverted null comparison and a non-null reference still can throw NullReferenceException.
If you are concerned about that, consider using the OrNull extension method: th-cam.com/video/Nk49EUf7yyU/w-d-xo.html