🌍 FREE C# Beginner Complete Course! ruclips.net/video/pReR6Z9rK-o/видео.html 🔴 Watch my Complete FREE Game Dev Course! 🌍 ruclips.net/video/AmGSEH7QcDg/видео.html 📝 C# Basics to Advanced Playlist ruclips.net/p/PLzDRvYVwl53t2GGC4rV_AmH7vSvSqjVmz 🌐 Have you found the videos Helpful and Valuable? ❤️ Get my Courses unitycodemonkey.com/courses or my Steam Games 🎮 unitycodemonkey.com/gamebundle Generics! Such a useful C# feature! Have you used them before?
Oh boy! I've been making a card game(looks pretty great so far) and I can't count how many times I asked myself "God I wish I could just write a function that takes and returns any type." This video and your video on delegates have turned my life upside down and probably saved me dozens of hours of slamming my head on my keyboard. cheers!
As top-notch as it gets! And I would add: There's a ton of over-the-top praise going on today (movies, politics, etc.) -- where excellence is not established in the craft, but rather the perception of what people think they see. This is pure craft -- and worthy of every bit of praise you get. I'm looking forward to watching more -- and many thanks for enlightening me. It's so good I can't believe some of this stuff didn't fully register before. But it's a testament to your work that I'm kicking myself. Thanks again!
Amazingly helpful lesson! I enjoy how you begin with the "lazy/incorrect" implementations before the 'proper' version. It definitely helps understand why you would want to implement the solution.
Really had a great time in learning these "unused" (in almost every tutorial) concepts. This should be the first playlist that everyone should go through in my opinion, otherwise they will end up just copying and pasting stuff without understanding them so much and having a hard time in creating their own clean and optimized code. Just so you have an idea, I've been using Unity for one and a half years and never knew about these C# features until I found your channel (grid tutorial)! Hell, I didn't even knew that there were constant updates and discussions around programming languages! Learning about core concepts like these and good practices is truly understimated in the coding community. This opens so many doors into creating new things. Anyways, I just wanted to thank you for showing people how much there is to learn besides simply implementing some specific features in a game! I think that once I master these concepts, I'll be able to have my games made quicker and more optimized!
Thanks for the kind words! Yup C# has tons of awesome features that a lot of people are seemingly afraid to use or just don't know about but if you take the time to learn them it will improve your code massively and make you much more productive. Best of luck in your learning journey!
You deserve way more popularity than you have. Especially when youtubers with 2m subscribers cover this exact topic without opening an IDE even once to show an actual hands on example, but instead rely on trying to talk about it alone. Seeing 23k views on this video when there are half-ass 4 minute videos with 1 million views on it makes me sad when they didn't even put 1/10th the amount of example, explanation, and precision you put into your video.
slowly but surely you would realize you have to learn constantly and there isn't really a stage to which you will understand everything... i know some java, c++, python, js, you name it. yet i when i start coding in c#, i still come here humbly. hope you enjoy coding and never give up learning.
I learned all of this on my own a few years back and it was a headache. I wish I had something like this then. Keep up the great work! I really dislike patreon for a lot of reasons, have you considered setting up a subscribestar or another way we can support you?
I have thought about just having a normal Paypal donate link but I also don't want to have way too many links which might confuse people. If you pick up the game bundle from the website you'll be helping out the channel and get some cool games to play!
You're simply awesome, Already watched a couple of your videos which I found pretty helpful!!, And will be watching a lot more from your channel, So thanks you !!!!
In short, a generic is a type compiled for user-defined types, at compile or execution time, capable of enabling a wide range of operations on the same type, or on types with similar properties. Unlike Java, where they are just abstractions from the runtime, in C #, generics effectively generate code.
Hey! I really enjoy your videos, I would like to learn programming but I really have no Idea where to start, what video would you recommend from your channel for someone n00b as me?
If you're a complete beginner in Unity watch these videos to get acquainted with the engine ruclips.net/p/PLzDRvYVwl53vxdAPq8OznBAdjf0eeiipT After that try making a complete game like this ruclips.net/video/b5Wpni9KPik/видео.html
I felt like i gained a lot of knowledge when watching your videos but the next second i forget almost half of it, guess i just have to try them out myself and not just keep watching them again and again 😅
That's normal, programming isn't really about memorizing but rather about problem solving, and that's a skill that takes time to really learn. As long as you're actively paying attention then you are learning, even if it doesn't feel like it Keep at it!
That's just the name for the Generic type, usually it starts with a T, so normally you have T1, T2 and if you have outputs normally they are named TResult
@@CodeMonkeyUnity I see. I am a bit new to C# and unity so was a bit confused. Also, the reason why i asked this is because i noticed that Action and Func used in and out but you didn't. Does that make any difference?
@@CodeMonkeyUnity I don't know anything about coding and such and watched this video by mistake. And after reading the comments , seems like many people found it helpful hence good video. Xd
Generics enforce the correct type. If you use objects then you can use one type for the first element and a completely different type for the second element which will break everything
You want to return 2 values, one of T1 and one of T2? If you're using C# 7 you can look into Tuples private (T1, T2) TestMultiGenerics(T1 t1, T2 t2); Or you can use out parameters private void TestMultiGenerics(T1 t1, T2 t2, out T1 t1Result, out T2 t2Result);
at 9:22, on line 36, I tried to give T a value of 2, "public T value = 2;" but got a type error. I'm confused by this because on line 19 I already set to . Is there a better way to do this?
When you make a class a generic you are saying that it will be compatible with just about any type. You can use it with an but you can also use it with a So you cannot define public T value = 2; because that would not compile if you created an instance of the class using anything other than int. If you want specifically to store an int then define public int value; If you want to store the generic type that the class uses then do public T value;
actually, I am working on my friends project it on c# and I want to popup a website from that software but we don't know how to change website links from server or database, we just need to change website link daily
I wanted to figure out how to use generic arrays but now I noticed the delegate keyword at the bottom of the screen for a second so I'm going to google what that does because I have no attention span
I made a video on delegates ruclips.net/video/3ZfwqWl-YI0/видео.html Essentially they let you define a function signature so you can store a function in a field or pass it as a parameter.
If your constaints are so limited that only a single class is valid then sure at that point you might as well use that class directly. But the goal of generics is to allow your code to work with any number of classes, if that's not what you want then yea don't use generics.
THX! Code Monkey Please make some tuts about bake simulation (such as particle) in unity! I know that it works with an Array saving time and transform data of the particles but, to avoid crash during billions particle simulation how to write code in unity?
@@CodeMonkeyUnity I mean the way it works! For instance, most studios use Houdini to simulate physically correct particle system and then exports it to any engines ! Here I want to use Unity to simulate entities with physical system and then use that cache data to work further!!!
Why don't we just use a interface as function parameter than using generic and then limiting it to an interface? I mean interface and generics are kind of similar and I can't think much use cases for generics
That interface uses a generic type which that type must extend Entity For example you could use PlayerRepository : IRepository And make sure Player : Entity But not sure where you took that code from so check the source code for the specifics on what all those classes do
While this is one of the best overviews on generics i've seen so far it still feels rushed. Many examples could really need some more time to let the viewer wrap their head around what you are doing and some could use a more practical implementation; like what other than int would you usa in Damage(T t)? An example where T would make sense to use than simply int would be helpful to make it both more understandable and memorable.
A very special Thanks from INDIA.....!!!! [ A little help required....!!! ] Here is the thing: I request a tutorial for real-time level editor (i.e in-game level editing) for isometric 2d game Please make a tutorial on it, so that one can make a game in which they can make levels that uses game prefabs and play & share their creation (levels) {if someone uses the technique.} I needed an In-game Isometric type level editor for my game but I'm just a beginner and I don't know how to achieve it. It would be great video for others too..!!!!! whoever sees this like if you agree...! and if (Author) { please give us the tutorial for it.... }
@@CodeMonkeyUnity And that's why you won't get a subscription from me. I just watch the videos I need and move to other channels. Good luck getting rich off your RUclips channel with this attitude.
how is my opinion stupid? why complain when the learning resources you need are already present? why nitpick on this dude for merely 3 ads? if ads bother you so much, use an extension, entirely removes ads on other videos as well, youre whining over something as petty as an ad, im really sorry if things dont meet up with your expectations
🌍 FREE C# Beginner Complete Course! ruclips.net/video/pReR6Z9rK-o/видео.html
🔴 Watch my Complete FREE Game Dev Course! 🌍 ruclips.net/video/AmGSEH7QcDg/видео.html
📝 C# Basics to Advanced Playlist ruclips.net/p/PLzDRvYVwl53t2GGC4rV_AmH7vSvSqjVmz
🌐 Have you found the videos Helpful and Valuable?
❤️ Get my Courses unitycodemonkey.com/courses or my Steam Games 🎮 unitycodemonkey.com/gamebundle
Generics! Such a useful C# feature! Have you used them before?
Oh boy! I've been making a card game(looks pretty great so far) and I can't count how many times I asked myself "God I wish I could just write a function that takes and returns any type." This video and your video on delegates have turned my life upside down and probably saved me dozens of hours of slamming my head on my keyboard. cheers!
As top-notch as it gets! And I would add: There's a ton of over-the-top praise going on today (movies, politics, etc.) -- where excellence is not established in the craft, but rather the perception of what people think they see. This is pure craft -- and worthy of every bit of praise you get. I'm looking forward to watching more -- and many thanks for enlightening me. It's so good I can't believe some of this stuff didn't fully register before. But it's a testament to your work that I'm kicking myself. Thanks again!
Amazingly helpful lesson! I enjoy how you begin with the "lazy/incorrect" implementations before the 'proper' version. It definitely helps understand why you would want to implement the solution.
Thanks! I do work hard on the structure of the videos!
I love hearing tutorials say "the Func"
Da funk.
Really had a great time in learning these "unused" (in almost every tutorial) concepts. This should be the first playlist that everyone should go through in my opinion, otherwise they will end up just copying and pasting stuff without understanding them so much and having a hard time in creating their own clean and optimized code.
Just so you have an idea, I've been using Unity for one and a half years and never knew about these C# features until I found your channel (grid tutorial)! Hell, I didn't even knew that there were constant updates and discussions around programming languages! Learning about core concepts like these and good practices is truly understimated in the coding community. This opens so many doors into creating new things.
Anyways, I just wanted to thank you for showing people how much there is to learn besides simply implementing some specific features in a game! I think that once I master these concepts, I'll be able to have my games made quicker and more optimized!
Thanks for the kind words! Yup C# has tons of awesome features that a lot of people are seemingly afraid to use or just don't know about but if you take the time to learn them it will improve your code massively and make you much more productive.
Best of luck in your learning journey!
You are such a necessity for begginer programmers.Keep up the good work!
This tutorial is truly amazing. It's just opened a new door to me to work with Generics.
I was looking for a video on "Collections", somehow found this one, and I loved it. You got a +1 sub.
Keep it up, Mate.
Greetings from Germany.
Thanks! I'm glad you found the video helpful!
You deserve way more popularity than you have. Especially when youtubers with 2m subscribers cover this exact topic without opening an IDE even once to show an actual hands on example, but instead rely on trying to talk about it alone. Seeing 23k views on this video when there are half-ass 4 minute videos with 1 million views on it makes me sad when they didn't even put 1/10th the amount of example, explanation, and precision you put into your video.
I'm glad you liked it!
Again you turn something that seems daunting at first into something clear and easy to use! Cheers for the video ;)
definitely going to use these when I going to make a new tilemap system.
i'm still quite new to coding so i'm super thankful for tutorials like this :)
slowly but surely you would realize you have to learn constantly and there isn't really a stage to which you will understand everything...
i know some java, c++, python, js, you name it.
yet i when i start coding in c#, i still come here humbly.
hope you enjoy coding and never give up learning.
Best Generics Tutorial. Thanks a lot. I have subscribed.
Thanks! I'm glad you found it helpful!
Thank you for your absolutely free but full of effort vidoes, I always come back to this channel whenever I want to learn something.
Thanks! I'm glad the videos have helped you!
I was struggling understanding the concept of generics, understood it in the first 5min !
Thanks !
I'm glad the video helped you!
Simple and clear, this is how lessons should be! Thanks
andilabassa sa n sa
Thanks for the video, learnt a lot of things here.
Was able to solve my code 4 minutes in. Bless you dude!
I'm glad the video helped! Thanks!
I learned all of this on my own a few years back and it was a headache. I wish I had something like this then.
Keep up the great work!
I really dislike patreon for a lot of reasons, have you considered setting up a subscribestar or another way we can support you?
I have thought about just having a normal Paypal donate link but I also don't want to have way too many links which might confuse people.
If you pick up the game bundle from the website you'll be helping out the channel and get some cool games to play!
learning such thing is not gonna be even possible to me i'd give up so i respect you
I waited for this so looooooooooooooong. Thank you!
I like how after you present the concept of generics, you follow it with with some use case scenarios. Great video! 😅
What an amazing video, great explanation and editing, subbed and liked :)
I'm glad it helped you, thanks!
The best demo of generics I have seen
I'm glad the video helped you! Thanks!
Thanks mate! Very clear explaination!
Thanks for sharing with your valuable knowledge and thoughts in explaining this topic abour generics. I really wanted to know it better.
I'm glad you found the vide helpful! Thanks!
VERY useful and helpful video. I'll certainly add it to my bookmarks and will look at least one more time.
Awesome tutorial! Generics rocks!!! 👍🤓
Another excellent tutorial - the examples really bring it to life. Thank you!
This was very helpful Thankyou :)
I'm glad you found it helpful!
Thanks this cleared up my fuzzy understanding of generics
Helped a lot ❤️
Thanks for the video sir. 🙂🙌🏻
Thanks to you , now i’ve understood the real reason why generics are important and why they are useful
If you want to see a practical use case here is my Grid using Generics ruclips.net/video/8jrAWtI8RXg/видео.html
@@CodeMonkeyUnity thank you
You're simply awesome, Already watched a couple of your videos which I found pretty helpful!!,
And will be watching a lot more from your channel, So thanks you !!!!
I'm glad the videos helped you! Thanks!
Thank you, to create an amazing video.
It's helped me a lot to understand the c# Lang.
In short, a generic is a type compiled for user-defined types, at compile or execution time, capable of enabling a wide range of operations on the same type, or on types with similar properties. Unlike Java, where they are just abstractions from the runtime, in C #, generics effectively generate code.
Waw just waawww ... you keep blowing me away with these amazing tutorials, i learned so much. thank you!
Now onto delegates
Amazing explanation.
I'm glad the video helped! Generics are super poweful!
really well explained!
Great Teaching
What a great tutorial!
This video is EPIC!!
I can tell that you are a kind of person that like to starring directly into the sun.
Nope, just someone whose eyes burn for trying to focus on tiny white letters if I use dark mode
@@CodeMonkeyUnity XD, you got a point
Such helpful content!!
dude u should have 1 million subs
I miss those fast forwarding(which are quite soothing) stuff in your udemy strategy course 😄
yup as you can see we have a nice error xd since when errors are nice, great video as always.
Тhank you very much for the lesson, very clear, helped :)
Hey! I really enjoy your videos, I would like to learn programming but I really have no Idea where to start, what video would you recommend from your channel for someone n00b as me?
If you're a complete beginner in Unity watch these videos to get acquainted with the engine ruclips.net/p/PLzDRvYVwl53vxdAPq8OznBAdjf0eeiipT
After that try making a complete game like this ruclips.net/video/b5Wpni9KPik/видео.html
I felt like i gained a lot of knowledge when watching your videos but the next second i forget almost half of it, guess i just have to try them out myself and not just keep watching them again and again 😅
That's normal, programming isn't really about memorizing but rather about problem solving, and that's a skill that takes time to really learn. As long as you're actively paying attention then you are learning, even if it doesn't feel like it
Keep at it!
Thanks for the motivation bro
Thank you, I like this video
more vids for this playlist please!
Thank you!!!!!
good tutorial ... and then add an EmptyObject ... this is another reason why I like the C# and Unity 3D game engine.
at 7:37, what does the "in T1, in T2 ..." mean?
also, at 7:49, what does the "out TResult" mean?
That's just the name for the Generic type, usually it starts with a T, so normally you have T1, T2 and if you have outputs normally they are named TResult
@@CodeMonkeyUnity I meant the 'in' word that is before T1 and T2
@@anonymoussloth6687 in is an input parameter, out means output
@@CodeMonkeyUnity I see. I am a bit new to C# and unity so was a bit confused. Also, the reason why i asked this is because i noticed that Action and Func used in and out but you didn't. Does that make any difference?
Ngl I didn't understand much but good video regardless
What part didn't you understand?
@@CodeMonkeyUnity I don't know anything about coding and such and watched this video by mistake. And after reading the comments , seems like many people found it helpful hence good video. Xd
thank you :)
Very Nice
WOW thanks
5:49 well it makes sens but i got one Question left, why we dont worke withe Objekt's? it seams identicle 4 me
Generics enforce the correct type. If you use objects then you can use one type for the first element and a completely different type for the second element which will break everything
I only watched the first 4 minutes and then I got it. Short tutorials for people in a hurry
.... that was awesome
Why do the action and func delegates have the "in" keyword before the generic type, while your custom delegates seem to work without the "in" keyword?
The in keyword simply forces those parameters to be inputs, if you don't add it then they can be inputs or outputs.
at 6:40, is it possible to have TestMultiGenerics return t1 and t2? what should we use to replace void?
You want to return 2 values, one of T1 and one of T2?
If you're using C# 7 you can look into Tuples
private (T1, T2) TestMultiGenerics(T1 t1, T2 t2);
Or you can use out parameters
private void TestMultiGenerics(T1 t1, T2 t2, out T1 t1Result, out T2 t2Result);
@@CodeMonkeyUnity thanks so much for your detailed explanations! I find your videos extremely helpful and have subbed to your channel :)
Dude i love your tutorials. Could you make a game from stratch and record it for us.
I've made this one completely from scratch, it's my longest video! ruclips.net/video/b5Wpni9KPik/видео.html
thx dude
You forgot to explain covariance and contravariance in generics. But still very nice video for beginners :)
Is it possible to add a generic class in a list?
Sure, if you define MyClass inside it you can make a List or T[]
at 9:22, on line 36, I tried to give T a value of 2, "public T value = 2;" but got a type error. I'm confused by this because on line 19 I already set to . Is there a better way to do this?
When you make a class a generic you are saying that it will be compatible with just about any type.
You can use it with an but you can also use it with a
So you cannot define public T value = 2; because that would not compile if you created an instance of the class using anything other than int.
If you want specifically to store an int then define public int value; If you want to store the generic type that the class uses then do public T value;
How do you do this keyboard sound? 😎
It's the sound of my actual keyboard
Lol
Thx for the vid. But generics are using a lot more memory, right?
Compared to what? A class with a hardcoded type? I guess there would be some overhead but it will be miniscule
Will be ur student from now.
hey can you make a tutorial about perlin noise?
I have thought about doing some random map generation videos, could be interesting
actually, I am working on my friends project it on c# and I want to popup a website from that software but we don't know how to change website links from server or database, we just need to change website link daily
I wanted to figure out how to use generic arrays but now I noticed the delegate keyword at the bottom of the screen for a second so I'm going to google what that does because I have no attention span
I made a video on delegates ruclips.net/video/3ZfwqWl-YI0/видео.html
Essentially they let you define a function signature so you can store a function in a field or pass it as a parameter.
BRO PLZZZ MAKE A TUTORIAL ON G DEVELOP . ... I JUST AM STARTING TO LEARNING TO CODE SO PLZZ
great vid~
what if i want to make a function that can create an array and name it for example i pass "hello" 3 int
it make int hello array length 3
int[] hello = new int[3];
Creates a new int array with 3 elements named 'hello'
@@CodeMonkeyUnity yes but i need a function that does this i pass at the function the name the type and the lenght
What's the purpose of constraint? Isn't it just better to just explicitly say that instead of type T, you wanna receive a type of IEnemy instead?
If your constaints are so limited that only a single class is valid then sure at that point you might as well use that class directly. But the goal of generics is to allow your code to work with any number of classes, if that's not what you want then yea don't use generics.
I'm looking for a AI chess tutorial.. Is it as big as I world image it would be?
So, what are the real usages of generics in Game Dev?
Check out the Grid System video to see a very practical example ruclips.net/video/8jrAWtI8RXg/видео.html
2:51
can't you use the object var instead ?
On where? On the T? No, var is a dynamic type that the compiler converts to the inferred type, it's not a type in itself
hi, i need help about music licence for my game background music, i just dont know where to buy. help help help.
Normally I get my music from AudioJungle
@@CodeMonkeyUnity thanks man. Each song has many license and price, which one is ok?I really can't pay 300 for each song right now😢
THX!
Code Monkey Please make some tuts about bake simulation (such as particle) in unity!
I know that it works with an Array saving time and transform data of the particles but, to avoid crash during billions particle simulation
how to write code in unity?
You mean the new particle system? I haven't used it yet but it's definitely on my list!
@@CodeMonkeyUnity I mean the way it works! For instance, most studios use Houdini to simulate physically correct particle system and then exports it to any engines !
Here I want to use Unity to simulate entities with physical system and then use that cache data to work further!!!
👏👏
Why don't we just use a interface as function parameter than using generic and then limiting it to an interface?
I mean interface and generics are kind of similar and I can't think much use cases for generics
nice
are you interested in vr in unity
Respect from Russia 🇷🇺🤝🇺🇲
I have to keep looking at these videos or else I will simply forget the concepts
The more you use them the more they will be stored in your memory, game development and programming is all about experience so keep at it!
@@CodeMonkeyUnity The only problem is that it is a full time job and even so, there are not enough hours in the day...learn, re-learn...on and on
I love the generics but don't know anything about unity!
internal interface IRepository : IDisposable where TEntity : Entity
^^
didnt understand this....
That interface uses a generic type which that type must extend Entity
For example you could use PlayerRepository : IRepository
And make sure Player : Entity
But not sure where you took that code from so check the source code for the specifics on what all those classes do
While this is one of the best overviews on generics i've seen so far it still feels rushed. Many examples could really need some more time to let the viewer wrap their head around what you are doing and some could use a more practical implementation; like what other than int would you usa in Damage(T t)? An example where T would make sense to use than simply int would be helpful to make it both more understandable and memorable.
A float.
A very special Thanks from INDIA.....!!!! [ A little help required....!!! ]
Here is the thing: I request a tutorial for real-time level editor (i.e in-game level editing) for isometric 2d game
Please make a tutorial on it, so that one can make a game in which they can make levels that uses game prefabs and play & share their creation (levels) {if someone uses the technique.}
I needed an In-game Isometric type level editor for my game but I'm just a beginner and I don't know how to achieve it.
It would be great video for others too..!!!!!
whoever sees this like if you agree...!
and if (Author)
{
please give us the tutorial for it....
}
From simple to hard in 10min
What is the best programming language for game development?
Depends on the engine, Unity only supports C#
Help me
I thought it said genetics
Too much to my brain.
14 minute video, 3 ads.
Yes? Is that bad? You get extremely valuable knowledge for free and only need to wait 15s
@@CodeMonkeyUnity And that's why you won't get a subscription from me. I just watch the videos I need and move to other channels. Good luck getting rich off your RUclips channel with this attitude.
Go pay for a course then????
@@jfk9090 ruclips.net/user/IAmTimCorey
When I want you stupid opinion, I will give it to you.
how is my opinion stupid? why complain when the learning resources you need are already present? why nitpick on this dude for merely 3 ads? if ads bother you so much, use an extension, entirely removes ads on other videos as well, youre whining over something as petty as an ad, im really sorry if things dont meet up with your expectations