Change colorMap but don't work

My game has a lot of roles.

I want every roles to have different particle when they die.

So I use script to change particlesystem’s colorMap

this.blue=this.app.assets.findByTag('blue')[0]; this.deadParticle.particlesystem.colorMap=this.blue.resource;

But it doesn’t work.

When the role die , the particle’s color is white which seems the script doesn’t work.

I also test with this script

this.blue=this.app.assets.findByTag('blue')[0]; this.deadParticle.particlesystem.colorMap=this.blue;

But don’t work,too.

Could anyone help me?

Thank you.

If you need more details,tell me.

Does this help:

https://playcanvas.com/project/428700/overview/particle-color-map

Created for this thread:

(I’m a bit confused because you started that thread!)

I’ve just tried this in a project and the code you have written works fine.

this.blue=this.app.assets.findByTag('blue')[0];
this.deadParticle.particlesystem.colorMap=this.blue.resource;

Sample project: https://playcanvas.com/project/436005/overview/changing-colour-map-of-vfx

1 Like