# Do babylon format objects accept applying textures within the code?

**URL:** <https://forum.babylonjs.com/t/do-babylon-format-objects-accept-applying-textures-within-the-code/23751>\
**Category:** Questions\
**Created:** [September 11, 2021, 10:01am UTC](https://forum.babylonjs.com/t/do-babylon-format-objects-accept-applying-textures-within-the-code/23751 "2021-09-11T10:01:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nova\_Hovekh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nova_hovekh/32/17215_2.png) [@Nova\_Hovekh](https://forum.babylonjs.com/u/Nova_Hovekh)\
**Post date:** [September 11, 2021, 10:01am UTC](https://forum.babylonjs.com/t/do-babylon-format-objects-accept-applying-textures-within-the-code/23751/1 "2021-09-11T10:01:36Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [September 11, 2021, 10:17am UTC](https://forum.babylonjs.com/t/do-babylon-format-objects-accept-applying-textures-within-the-code/23751/2 "2021-09-11T10:17:42Z")

</div>

Hey!  
What’s the mesh variable here?

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [September 11, 2021, 10:25am UTC](https://forum.babylonjs.com/t/do-babylon-format-objects-accept-applying-textures-within-the-code/23751/3 "2021-09-11T10:25:32Z")

</div>

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

EDIT: with texture  
[https://playground.babylonjs.com/#PFLMX9#1](https://playground.babylonjs.com/#PFLMX9#1)

---

<div class="post-metadata">

**Author:** ![JCPalmer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jcpalmer/32/42_2.png) [@JCPalmer](https://forum.babylonjs.com/u/JCPalmer)\
**Post date:** [September 11, 2021, 1:48pm UTC](https://forum.babylonjs.com/t/do-babylon-format-objects-accept-applying-textures-within-the-code/23751/4 "2021-09-11T13:48:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Nova\_Hovekh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/nova_hovekh/32/17215_2.png) [@Nova\_Hovekh](https://forum.babylonjs.com/u/Nova_Hovekh)\
**Post date:** [September 16, 2021, 11:30am UTC](https://forum.babylonjs.com/t/do-babylon-format-objects-accept-applying-textures-within-the-code/23751/5 "2021-09-16T11:30:33Z")

</div>

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
