Do babylon format objects accept applying textures within the code?

hello . i’m trying to add textures to a 3d object .babylon format with :

let myMaterial = new BABYLON.StandardMaterial(“myMaterial”, scene);
myMaterial.diffuseTexture = new BABYLON.Texture(“meshpath”, scene);
mesh.material = myMaterial;

like i saw in the docs but its just don’t work (no error displayed in console) . i tried it with generated cube and it works just fine so i don’t get it why it’s not working with my mesh.babylon ?

What’s the mesh variable here?

1 Like

I’ve created a working example for you:

EDIT: with texture

1 Like

If it works on a cube but not your mesh, then the best guess is that the mesh is missing UVs. On tablet. Cannot check your pg.


sorry for the late reply and thank you so mush .

i forgot to assign a variable for the mesh inside of the loaded file . i threated the entire loaded file as a mesh

1 Like