Node in the scene which is not mesh but his class says it is

Hi guys. In the app, I am creating a lot of stuff dynamically. I check active meshes, for each mesh I call a lot of functions etc…
But there are certain situations where I load some model and that model have some nodes which are basically not mesh, but their className says that they actually are. (usually it’s like some group node, for example that root node which exists in gltf files).

So in my code I am getting errors, because I am calling a name of material of the mesh and the material of particular node/mesh is null, and I am getting an error.


I tried to check if I can somehow differentiate the two (notice they have same name, same class…). I cannot use mesh.material (which is null in the case of that group node) to exclude the non-mesh, because there will be some meshes loaded which will not have material but they will be actual meshes, so I will deal with those differently.

So is there any trick/hack on how to do this?

Do you have a file with such nodes we can check?

It must be possible to differentiate them as the inspector does it: it displays a different icon for each case.

For a given node, when getClassName() has “mesh” in its name, the inspector displays it as a mesh if: mesh.isAnInstance || mesh.getTotalVertices() > 0, else it displays it as a TransformNode.

That solved it. I was thinking about vertices thing but I didn’t figure it out properly xD. Thank you so much. I appreciate it