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 ?

Hey!
What’s the mesh variable here?

I’ve created a working example for you:
https://playground.babylonjs.com/#PFLMX9

EDIT: with texture
https://playground.babylonjs.com/#PFLMX9#1

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