Error on previously working material offset/tiling manipulation

Hello all,

I’m guessing this is related to a recent engine push, but a script that I had that sets tiling and offset on an object is now pushing errors when attempting to set those parameters. The error that I get is:

Uncaught TypeError: a.equals is not a function

and a stack trace of:

Uncaught TypeError: a.equals is not a function
onload Space/Scripts/lbMediaScripts.js?id=49143186&branchId=0e26414b-2c2b-4d2d-9f09-01135c2cdc61:25
initialize Space/Scripts/lbMediaScripts.js?id=49143186&branchId=0e26414b-2c2b-4d2d-9f09-01135c2cdc61:19

Here is the related script that is making causing the trouble:

var LbLitMat = pc.createScript('lbLitMat');

LbLitMat.attributes.add('id', {
    type: 'string',
    title: 'Content ID'

LbLitMat.prototype.initialize = function() {
    this.entity.render.meshInstances[1].material = this.entity.render.meshInstances[1].material.clone();
    var self = this;

    var image = new Image();
    image.crossOrigin = "anonymous";
    image.onload = function () {
        var texture = new pc.Texture(;

        var material = self.entity.render.meshInstances[1].material;
        material.diffuseMap = texture;
        material.diffuseMapOffset = {x: 0, y:0};
        material.diffuseMapTiling = {x: 1, y:1};
    image.src = alliedBasePath +;

Any ideas?

A quick look is that you would need to use pc.Vec2s instead:


        material.diffuseMapOffset = new pc.Vec2(0, 0);
        material.diffuseMapTiling = new pc.Vec2(1, 1);
1 Like

Hi @yaustar,

Changing those line of code to those suggested did indeed work. Is there any reason you an think of that they worked in 1.45.3? It looks like the jump to 1.46.0 is what broke the script.

Edit: I started tracing my way through the changes in 1.46.0 and came across this:

You guys are fast!