Comments (14)
So it does. That was pretty dumb on my part.
from particle-emitter.
No worries - programming happens!
I noticed when I was debugging a box2d particle I created - the box2d bodies weren't being cleaned up.
There may also be a few other memory issues too - Even after I modified the for loop to continue, particles seem to be sticking around when I check the heap snapshot profiler in chrome.
from particle-emitter.
When I get a chance to take care of this, I'll look around for other references.
from particle-emitter.
I released version 1.6.3, which fixes the emitter issue and does other cleanup improvements. I didn't see any other references within the library that would cause particles to stick around, though.
from particle-emitter.
Awesome - I'll check it out tomorrow - Thanks Andrew!
from particle-emitter.
Hi,
I've been following this as well and have been trying to properly delete the particles but without success as well.
Having updated to 1.6.3 the problem still remains @andrewstart the issue is that it's being referenced by the renderer and never let go, unlike normal sprites
I'm going to keep trying to figure it out but any help would be appreciated.
from particle-emitter.
Ah, I see - the SpriteRenderer is resetting the batch size in order to overwrite sprite batch entries which I assume has performance benefits from not trying to shrink and grow an array all the time. It also has the side effect of keeping references to destroyed sprites, if you have fewer sprites to draw than before. When you destroy a particle emitter, you suddenly have far fewer sprites than before. A workaround would be to reset the SpriteRenderer's sprites
array when you want to wipe it, I believe with myWebGLRenderer.plugins.sprite.sprites.length = 0;
.
from particle-emitter.
@andrewstart unfortunately that doesn't seem to fix it, any ideas?
from particle-emitter.
That was my only easy idea. I'll have to dig into it this weekend.
from particle-emitter.
The other reference keeping the particles from getting garbage collected has been fixed in 1.6.6. You'll still need to reset the SpriteRenderer's sprites
array, but once you do that the particles should get properly taken care of.
from particle-emitter.
@andrewstart that worked, I can confirm they're being properly disposed now.
Thanks!
from particle-emitter.
Upgraded to the latest pixi (4) and pixi particles (1.6.7) and particles are still not being destroyed properly.
Am I correct in assuming I can do:
emitter.emit = false;
and then a bit later
emitter.destroy();
this.renderer.plugins.sprite.sprites.length = 0;
When I step into the cleanup function, it doesn't find any particles to destroy (I wait until the particleCount == 0) even though I can still see a few faint dots on the screen.
from particle-emitter.
That should be correct. cleanup()
removes any active particles, which shouldn't find any particles if you've waited for all the particles to expire. destroy()
is what wipes the particle pool. Are you using a Container or ParticleContainer?
from particle-emitter.
Thanks for getting back to me! I'm using a Container but I found my issue. I was removing the emitter from an array right after destroying it. Moving the array.splice to right before the emitter.destroy resolved my problem.
from particle-emitter.
Related Issues (20)
- IntColorComplex throws null exception HOT 2
- LinkedListContainer doesn't play nice with Destroy method HOT 1
- The particle emitter can encounter undefined particles which casues it to choke and break HOT 3
- particle systems run slower after migration from 4.3.x to 5.0.7 HOT 4
- Artifacts when using `playOnce` HOT 4
- can not use editor export json file HOT 4
- When to support pixi 7.0 HOT 1
- npm install errors upgrading to Pixi 7 HOT 3
- Can not use editor export json file - Format seems different HOT 1
- emitter.updateOwnerPos throws an error if emitter is destroyed HOT 2
- It extends Container, not ParticleContainer HOT 1
- Classes not invoked with new? HOT 3
- [inquiry] does Pixi particles use instanced rendering? HOT 3
- Need to interact with particular particle on mouse touch and destroy it HOT 2
- Alpha interpolating doesn't work for images HOT 2
- animatedSingle behaviour HOT 7
- Is the project will keep update? HOT 4
- Where can I find a CDN link to new version ? HOT 1
- Bug: PropertyNode.createList leads to errors if there are two points with same value HOT 2
- Best practice for continuous trail on a fast-moving object? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from particle-emitter.