pixijs / particle-emitter

A particle system for PixiJS
http://pixijs.io/particle-emitter/docs
MIT License
799 stars 127 forks source link

Emitter Cleanup #108

Closed JB-Scott closed 5 years ago

JB-Scott commented 5 years ago

There is the following note in the documentation:

"When using PixiJS 3+, the SpriteRenderer in WebGL may keep a reference to your particles after you have destroyed your emitter. To ensure that they are garbage collected, in WebGL only, reset the SpriteRenderer's sprite batching with yourRenderer.plugins.sprite.sprites.length = 0;"

It seems that the changes to the way rendering is done in PIXI v5 mean this code is no longer possible. Is there still a need to do the same sort of thing in PIXI v5? If so, what is the appropriate code to call?

andrewstart commented 5 years ago

I believe that the v5 code would be yourRenderer.plugins.batch._batchedElements.length = 0;. Looking at BatchRenderer, it is probably still needed, but you shouldn't need to do it much. I would only do it when unloading a level or something similar, when you want to deep clean everything in preparation for what comes next.

andrewstart commented 5 years ago

Nevermind, no longer needed for V5.

JB-Scott commented 5 years ago

Thanks for confirming it is no longer needed.