Hi folks,
how can I access the name of a type inherited from MonoBehaviour?
I’ve got a code block that looks like this:
var objCollection : List.<MyBehaviour>;
for(var obj in objCollection)
{
Debug.Log("Type: " + (typeof obj));
}
where MyBehaviour inherits from MonoBehaviour. The collection however contains elements of other types that themselves inherit from MyBehaviour. I’d like to get the name of the “deepest” type in that inheritance tree. Debug.Log only writes “Type: MyBehaviour” to the log.
I’d like to invoke specific actions depending on the type of ‘obj’.
Any idea?
Thanks a lot!