Sign in to follow this  
Koroldev

Particles dispose

Recommended Posts

Hi!

Have some problem, I create many particles systems in my game and very often delete them after first playing, but if I using the same texture in particle systems, then after first disposing of particle system the texture disposing too.

And I should to cloning each one new texture, but it is bad for performance. How I can to create a particles systems with same texture but after disposing particles system do not dispose texture?

Thanks!

Share this post


Link to post
Share on other sites

Hi @negrant

You could as you also mentioned clone the texture,

Another option is to create your own dispose function, copy/paste the particleSystem.prototype.dispose function from core babylon.js file and remove the part which dispose the texture.
A third option would be to not dispose them, keep the particleSystems in an array, simply stop() the particleSystems when they should end, and reuse, re-position/etc, and start().

Share this post


Link to post
Share on other sites
On 17.02.2018 at 12:19 AM, Deltakosh said:

We can also think about updating the dispose function of the particle system to add a boolean to let the system knows that you don't want the texture to be disposed

It would be cool! B)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.