engine icon indicating copy to clipboard operation
engine copied to clipboard

Destroying entity containing a Sprite does not remove sprite

Open Nigh7Sh4de opened this issue 11 years ago • 3 comments

A simple entity containing a single script component has 2 scripts on it: sprite.js and it's own script.

It's own script runs this.entity.destroy(). The sprite remains. (even though the application context no longer has the entity)

However, if one runs this.entity.enabled = false before destroy() then the sprite is removed properly.

Nigh7Sh4de avatar Feb 13 '15 20:02 Nigh7Sh4de

Could you please post simple test application, wether using tools or pure engine on lets say jsfiddle?

Maksims avatar Feb 13 '15 20:02 Maksims

I could not simply create a jsfiddle or a codepen because the sprite.js script must be in it's own file.

I have created a project in PlayCanvas to illustrate the problem and the workaround: https://playcanvas.com/project/337724/overview/sprites (left mouse click is just destroy and right mouse click is enabled = false; destroy();

Nigh7Sh4de avatar Feb 13 '15 23:02 Nigh7Sh4de

I have pushed a fix to sprite.js which fixes the issue. Get the latest from https://github.com/playcanvas/sprites

vkalpias avatar Feb 18 '15 16:02 vkalpias