I know how to change the scale, location, and stuff like that of an entity with a script, but how do we change the material (not the existing material color, but actually switch to another existing material).
I have set up a project which focuses solely on this, currently it detects a click on the model and fires the switchMaterial script, which then executes the update method in that script one time. The code I’m lacking is the actual switching of the entity material (not the global asset material).
https://playcanvas.com/project/578210/overview/entity-material-switcher
In this example project, there is a male.json model with an asset material named Material0 and an entity material named Material1. I’m trying to switch the entity material from Material1 to Material2 on click.
If someone figures this out, maybe put the fixed fork on the tutorials page, it would be very useful.