public static List<T> FindComponentsIn<T>(Transform inT, bool activeOnly = true, bool recursively = true) where T : class
{
List<T> res = new List<T>();
Transform ch;
T c;
for (int i = 0; i < inT.childCount; i++)
{
ch = inT.GetChild(i);
if (activeOnly && !ch.gameObject.activeSelf)
continue;
c = ch.GetComponent<T>();
if (c != null)
res.Add(c);
if (recursively)
res.AddRange( FindComponentsIn<T>(ch, activeOnly) );
}
return res;
}
… this null - is some kind of some special like world ether?
and if it somehow helping for understand, then the transferred T is a Collider
I think your collider is not null. It’s just attached to a GameObject whose name is the string “null”. Here’s what my debugger looks like with an actual null component:
And here’s what it looks like when I have a GameObject named “null”:
Notice the quotes, the object type, and the dropdown arrow?
But I didn’t create an object named: null. Here is the hierarchy of objects, and here is this object that skips the check, and there are no components on it.
Okay, this looks like the result of the internal work of the engine, where it is necessary to understand this null object as a result of a failure in the engine or outside …
Yeah my explanation doesn’t seem to completely add up because there is a Transform variable in your code ch which obviously is attached to the same object as the collider, and it’s properly showing the name of the GameObject as “Legs”. So something else weird is going on!