Thankyou! So where I tend to use that is for where I want to link things by type/class rather than the direct instance. For example with the new AI Perception system I built I had a "Perceivable" class that would go on anything that could be detected. I wanted that to be able to say what sensors (vision, sight etc) it supported and allow it to be expandable. So that has a List to handle performing that linking. That then simplified a lot of the setup in the perception system and it meant if someone created a new class based on that they didn't need to go and update the Perceivable class or anything else, they could just write the logic for their sensor. Although it's a small part of it there is a tutorial on that perception system available here (it's two parts): Part 1 - czcams.com/video/m495YxiPJv4/video.html Part 2 - czcams.com/video/-5YJp8AA2Go/video.html
@@IainTheIndie Ooh I see. Rather useful in those cases, but I assume in case I don't need to filter subclasses I can either set the generic to UnityEngine.Object or simply do the same but without generics at all. Thank you!
Great video as always!
Thank you!
Thank you! This is a big help
Thank you! Awesome to hear it was helpful!
Great tutorial! Quick question. In what scenarios would I want to use generics and filter just subclasses of a certain type?
Thankyou! So where I tend to use that is for where I want to link things by type/class rather than the direct instance. For example with the new AI Perception system I built I had a "Perceivable" class that would go on anything that could be detected. I wanted that to be able to say what sensors (vision, sight etc) it supported and allow it to be expandable.
So that has a List to handle performing that linking. That then simplified a lot of the setup in the perception system and it meant if someone created a new class based on that they didn't need to go and update the Perceivable class or anything else, they could just write the logic for their sensor.
Although it's a small part of it there is a tutorial on that perception system available here (it's two parts):
Part 1 - czcams.com/video/m495YxiPJv4/video.html
Part 2 - czcams.com/video/-5YJp8AA2Go/video.html
@@IainTheIndie Ooh I see. Rather useful in those cases, but I assume in case I don't need to filter subclasses I can either set the generic to UnityEngine.Object or simply do the same but without generics at all. Thank you!