Issue when destroying objects (bug introduced since 21st Sept 2018)

On Friday, my project was working fine. Upon resuming work on it this morning, I quickly found my scenes were no longer being destroyed correctly. Code such as this was causing an error:

this.on('destroy', this.onDestroy);
this.entity.collision.on('collisionstart', this.onContactStart, this);

GameObject.prototype.onDestroy = function()
{'destroy', this.onDestroy);'collisionstart', this.onContactStart, this);

The error: “Uncaught TypeError: Cannot read property ‘off’ of undefined”

In the onDestroy function, this.entity no longer has a collision object from which to remove the event. As I say, this was working fine until this morning, and many scripts in my project rely on it.

At the end of every day, I export my project and save it into SVN. Out of curiosity, I exported a new version with this problem in it and just swapped out the playcanvas-stable.min.js file with the one from Friday’s export, and it worked fine. So something changed in the meantime has caused this issue. The files are indeed 1kb different.

I’ve made a sample project here:

Any advice would be greatly appreciated, thank you.

While this is being looked at, you can temporary use an older version of the engine in the launch window:

That should keep you going in the meantime.

1 Like

This now seems to be happening regardless of what version of the engine I set it to: (this is the same sample project as linked above)

We are going to look into this thank you.