# Edit materials on imported meshes?

**URL:** <https://forum.babylonjs.com/t/edit-materials-on-imported-meshes/1428>\
**Category:** Content creation (3dsMax, Maya, Blender, glTF)\
**Created:** [February 16, 2019, 3:37pm UTC](https://forum.babylonjs.com/t/edit-materials-on-imported-meshes/1428 "2019-02-16T15:37:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Num\_T](https://avatars.discourse-cdn.com/v4/letter/n/49beb7/32.png) [@Num\_T](https://forum.babylonjs.com/u/Num_T)\
**Post date:** [February 16, 2019, 3:37pm UTC](https://forum.babylonjs.com/t/edit-materials-on-imported-meshes/1428/1 "2019-02-16T15:37:37Z")

</div>

I’ve got an exported .babylon file from 3ds Max which I’ve tried importing the meshes from using SceneLoaded and AssetsManager but am struggling to edit the existing materials on the meshes that are loaded as they are null when I am trying to access them.

I get that this is down to the async nature of this process but cannot for the life of me work out how to tie into a callback to set additional material properties once the buggers have loaded.

All of the tutorials I can find always seem to be about creating new materials - how can I edit existing ones… once loaded???

---

<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:** [February 16, 2019, 3:56pm UTC](https://forum.babylonjs.com/t/edit-materials-on-imported-meshes/1428/2 "2019-02-16T15:56:19Z")

</div>

The only real trick is getting a reference of the Material object. Once you have that you can set properties just as the creation docs show.

You might get the material from `mesh.material` by getting the mesh from `scene.getMeshByName`, `scene.getMeshByTag` or `scene.getMeshByID`.

If you know the name, tag, or ID of the material, you might get it directly from `scene.getMaterialByName`, `scene.getMaterialByTag`, or `scene.getMaterialByID`.

I am not really familiar with 3ds Max, but think their ID’s are some sort of generation. Also, do not know if they have a tag. That, I guess, is your job to figure out.

---

<div class="post-metadata">

**Author:** ![Num\_T](https://avatars.discourse-cdn.com/v4/letter/n/49beb7/32.png) [@Num\_T](https://forum.babylonjs.com/u/Num_T)\
**Post date:** [February 16, 2019, 4:09pm UTC](https://forum.babylonjs.com/t/edit-materials-on-imported-meshes/1428/3 "2019-02-16T16:09:41Z")

</div>

Well I can get a reference to where it should be when I import the mesh but its a question of timing. It’s null when I am trying to access it as it hasn’t loaded at that point in time. God I hate JS sometimes. I’m afraid I’m a lowly artist trying to support the developer here lol

---

<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:** [February 16, 2019, 4:11pm UTC](https://forum.babylonjs.com/t/edit-materials-on-imported-meshes/1428/4 "2019-02-16T16:11:31Z")

</div>

Must be in the callback of Scene.Append. It will exist then. Do not know about Asset Manager, but if it has a callback, that would be a good guess.
