I’ll have to test for a lot of ‘Types’, and to avoid repeating a very long almost identical code, I’m trying to make it a function.
But I’m not sure how to pass ‘Type’ as a parameter?
This works / hardcoded:
foreach (MeshFilter one in checkthis.GetComponentsInChildren<MeshFilter>())
now, I’m trying to set ‘Meshfilter’ up to be a variable instead, like so:
foreach (thisType one in checkthis.GetComponentsInChildren<thisType>())
- But I cannot write a proper variable for ‘thisType’, so it can be for example MeshFilter SkinnedMeskRenderer, sharedMaterial… Is this even possible, how would you?
Thanks a bunch
@Bunny83 ?