remove event ondestroy playcanvas 1

remove event ondestroy playcanvas

pc.Entity.prototype.destroyOld = pc.Entity.prototype.destroy;
pc.Entity.prototype.destroy = function() {'beforedestroy', this);

Here is what the above code is Doing:
1. It’s creating a new event called ‘beforedestroy’
2. It’s adding a new function called ‘destroy’ to the pc.Entity prototype
3. It’s calling the original ‘destroy’ function
4. It’s firing the ‘beforedestroy’ event

The code above is a bit of a hack, but it works.

Similar Posts