❔ Getting Inherited Generic-Typed Inner Classes With Reflection
If I have a class layout like this... By the way the Vector3Int type is from Unity but just know that its axes can be indexed like shown below
How would I use reflection to get an array of the "Add" and "Subtract" classes specifically dervied from Vector3IntOperator? I've tried doing this but it doesn't seem to work... (This bit uses some linq aswell)
2 Replies
it might be that
.IsSubclassOf()
only checks for DIRECT parent/child relationships
not the full ancestry
the docs page isn't really clear on that, one way or the other
try swapping to .IsAssignableFrom()
the docs DO say explicitly that Assembly.GetTypes()
should include all nested and non-public types, so that's not the issue
otherwise, you're just gonna have to crack down and debug itWas this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.