Material Variants Not Working

Hi all,

I’ve been teaching myself Three.js lately, attempting to create a configurator with it for work, letting users change the material. I’ve ran into the issue of the mapping variable results in “undefined”.

It’s able to grab the variant names, so I’m able to change them in the GUI, but the material doesn’t update in the viewport

This is my code for the changing the variants:

glTF model data:

However, the app is able to recognize the information from the glTF when the remove the “.includes(variantIndex)” part of the mapping variable. But the materials don’t update for some reason.

Does anyone know how to resolve this? Thanks!

Hav you find an answer ? I am facing the exact same issue and for the love of me I cant find how to fix it…