Beginner: Imported mesh won't

I exported the starting cube from Blender as a .glb (with and without the material included), then loaded it in Babylon and assign it a material, but the material doesn’t seem to display. Is there something I need to do when exporting for it to appear properly?

In the Playground linked, the sphere, and both cubes have the same material, but only the sphere is red. The middle cube was exported from Blender without its material, the one on the right with the material.

I have only just started using Babylon.js, so maybe I’m being stupid, but I have spent hours trying to get this working and reading the docs.

Background: I have some 3rd party models in fbx format. I want to import them with their UV mappings into Babylon and then apply a texture to them at runtime (because the player may change the texture displayed). I tried doing this by converting them to .glb in Blender and then saving them. I can see the UV mapping on the model, but could not get a texture to display. I then worked backwards to the simple case in the Playground linked - no material seems to be working.

If you want to apply the red material on both of your imported meshes, then you have to apply on cube mesh and not root-mesh of glb, which has no vertices, so material won’t affect the cube mesh. In your case, just change meshes[0] to meshes[1].

Fixed Playground:

Also you can use Inspector to check meshes and their materials:


Thankyou very much! that has fixed the problem and I didn’t even realise that inspector was there, I will make definitely be making use of that in future!