Texture is not set when cloning a particle system

I’m trying to use ParticleSystem.clone to avoid parsing the ParticleSystem snippet everytime I need to enable the same system on a different emitter. However, as can be seen in Babylon.js Playground, the texture is not set when the PS is cloned. Is this expected? Do I need to manually set the texture ref when cloning a particle system?

I don’t know if it’s expected, but it works fine when explicitly setting particleTexture on the clone, either by ref or by cloning the original’s texture, as seen here: https://playground.babylonjs.com/#511WRD#2

Maybe @Deltakosh knows if there’s a reason the texture isn’t cloned along with the particle system?

There’s a parameter to serialize textures when calling serialize directly but not when calling clone. This PR will add a new parameter to clone to also clone textures:


Thanks. Would cloning the textures have any increased memory or perf impact versus just setting the ps texture ref to the cloned ps texture?

Not really because both textures will use the same InternalTexture internally, so there’s no texture data content duplication. You will consume a little more memory to account for the new Texture instance.