[SOLVED] Can I change materials of loaded asset from GLB?

I have an asset loaded from URL.

It is a cube with 6 different materials for each side.
After I load this asset into my playcanvas application,
I want to change the material of each side.

Is this possible?

Hi @lenvanthis!

If the asset has a mesh for each side, you can adjust the material independently.

I recommend sharing a sample project with your asset, because it is dangerous for other users to download unknown files.

Got it. Currently it has 6 materials defined for one mesh. We will change into 6 meshes for each side, and test it. I will let you know.

I actually had to change asset.resource.data.materials.
In this example, it has only one mesh defined.
https://playcanvas.com/project/1185595/overview/loading-glb

@Albertos Thanks for the hint!

1 Like