Adding uniforms in custom materials


I assume there’s a typo bug in AddUniform method in both CustomMaterial (source) and PBRCustomMaterial (source):

if (kind.indexOf("sampler") == -1) {
    this._newSamplerInstances[kind + "-" + name] = param;
else {
    this._newUniformInstances[kind + "-" + name] = param;

The condition should rather have !== like:

if (kind.indexOf("sampler") !== -1) {


1 Like

I would say yes as well adding our friends @nasimiasl and @MackeyK24 who are using the custom materials ?

1 Like

hi thanks for notice that is true but the main reason the ‘param’ parameters not used so much i guess we can remove that because we need update that parameter after effect be ready

1 Like

thanks for the response, my use case is that I use param as an “initial” value for float uniforms that don’t need to be updated

1 Like

ok i will make PR now


@nasimiasl thank you! confirm that it’s fixed in 4.2.0.-alpha.21