Take the 2-minute tour ×

Working in the latest Unity3d 3.5 if it matters.

If I have a set of classes:

Class A extends MonoBehaviour
Class B extends Class A
Class C1 extends Class B
Class C2 extends Class B

And I have a GameObject that has C2 as a component. Will GetComponent.<A>() return the C2 component?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Well, I haven't tried a three-level hierarchy but, for two, I can confirm that GetComponent works as you expect.

share|improve this answer
add comment

Your Answer


