Check if class belongs to part of tree (extended from)

In javascript:

if class B extends class A

and variable C = B

how can I check if C is an extension of A?

I guess you use UnityScript (since you talk about “extend”). Usually there’s the “is”-operator. It should work like this:

if (C is classB)

So i guess the variable C is of type classA and hold a reference to an instance of classB. In this case the above statement should return true.

I’m not sure if the is-operator exists in UnityScript, but since they adapted most JS-unusual stuff from C# it should work :wink: