Tween changes / errors in engine 1.66

Hi, I just started getting random tween errors in my game on nothing I’ve been working on. A new update arrived just a couple of hours ago so I’m guessing they may be connected. Especially as this happened a few months back.

I could be wrong of course but the errors are on scripts with tweens that I haven’t opened for weeks and are unconnected to my current work. Is anyone else getting issues?


[main.js?id=125125687&branchId=3066db9f-2c18-4f85-8166-93aa92ed21e3:791]: Uncaught TypeError: this.opacityTween_OUT.start is not a function

TypeError: this.opacityTween_OUT.start is not a function


Texture height must be an integer number, got

[object Object]

1 Like

I can confirm that going back to version 1.65.5 I don’t get any errors.
1.66.0 has errors
1.66.1 has errors

See the breaking change here: Release v1.66.0 · playcanvas/engine · GitHub

Ok Thanks. So how can I fix it?

Grab the updated tween script:
and follow the suggestions here: onUpdate, onComplete, onLoop methods instead of events by Maksims · Pull Request #42 · playcanvas/playcanvas-tween · GitHub

1 Like

Thanks. Quick question. If I have the following code…do I also need to get rid of the ‘bind’? eg…

  .on('complete', function () {
        //do stuff

to… :

.onComplete(() => {
        //do stuff
    }//no bind here?

Otherwise I get an IDE error.

most likely yes

Thanks. I think a separate error cause by the update and not covered here is this error:

Texture height must be an integer number, got
[object Object]

Any ideas how to resolve that one?

put a breakpoint to see what the problem is?

1 Like

Thanks. :slight_smile: I have some code as follows but following the upgrade hints the tween no longer works. How can I modify this code to work?

this.opacityTween_IN = this.entity.tween(this.opacityScreenFade).to({value: 1}, 0.5, pc.Linear)
.on('update', this.onFade, this);

I tried…

this.opacityTween_IN = this.entity.tween(this.opacityScreenFade)
		.to({value: 1}, 0.5, pc.Linear)
        .onUpdate(() => {this.onFade,this});

…but the fade no longer happens. No errors though…

What is this () => {this.onFade,this}? Use proper syntax, don’t try random stuff.

You need to pass it a function that would call your onFade. One option:

.onUpdate(dt => this.onFade(dt))

My tween code is updated like below.

this.entity.tween(this.opacity).to({value: 1}, 3, pc.Linear).onUpdate(() => { this.onFade(); }).start();
1 Like

Thank you all. It all works again now.

1 Like