Is there a way to reveal class type by `console.log()`?

Hey community,

Just wondering, is there a way to display the class type simply using console.log?

For example,
I printed one array, one matrix and one vector3

I added some comments when printing so I know what they are.
But how about the time when simply print the content for any babylon class instances. How would I tell if it is an Matrix, a Vector3? or a Mesh? or Animatable? etc? When checking the items of the instance content, I couldnt be able to tell.

Many thanks,

Vector3 | Babylon.js Documentation (

All the objects of Babylon have “getClassName”


@xiehangyun thats neat! Looks not every class has this method but looks for most of them they do!! Thank you so much.

I think this should be a baseline method that all classes should have, and it can provide support for quick serialization and deserialization.

1 Like

We can add the one missing.Happy to look at a PR if you want to add the missing ones

1 Like