How to create a Particles2D with multiple textures?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Diet Estus

I have a destructible object and I want to create a Particles2D when it is destroyed which emits a few different debris sprites in every direction.

It’s easy enough to create a Particles2D with spread = 180 and one custom texture, but how could I go about changing this texture for every particle that’s emitted?

I know there’s no built-in functionality to achieve this, but I am wondering if there’s a hack?

Can’t you just make a second particle system with a different texture?

SIsilicon | 2018-09-30 02:27

:bust_in_silhouette: Reply From: omggomb

Inside the ParticleMaterial use Animation->Offset = 1 and Animation->OffsetRandom = 1, this will chose between all frames of your texture randomly. By leaving the AnimationSpeed at zero, it should basically yield what you want.

This doesn’t seem to work for me :(. Tried with GPU and CPU particles, animation speed doesn’t seem to have any effect (animated texture is still animated). I tried setting animated texture fps to 0, but that causes all particles to be same.

monnef | 2019-07-02 08:07

I’m not sure if my answer is actually what the OP asked for, but for clarity I made an example project in Godot 3.1.1 Dropbox Link

What needs to be done is to define the number of frames for the texture inside the CanvasMaterial for the particle emitter (not in the particle material). I did everything else as described and it seems to work.

omggomb | 2019-07-02 10:22