Destroying entity containing a Sprite does not remove sprite
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.
Could you please post simple test application, wether using tools or pure engine on lets say jsfiddle?
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();
I have pushed a fix to sprite.js which fixes the issue. Get the latest from https://github.com/playcanvas/sprites