Best way to share colors between ParticleSystems


Let’s say I have to create about 300 ParticleSystems, using 20 differents particle shapes (so 20 grayscale textures) and 5 main colors (and a few other ones, for specific cases).

Question: what would be the best way to share these 5 colors between all the ParticleSystems?

My goal is to be able to change the particle colors in the whole game with just one change for each color, instead of going through all the ParticleSystems (and their sub-ParticleEmitters) to change the values in the “Initial Color” or “Color Over Life” modules.

I though about 3 solutions, but none of them seem easy:

  1. One base Material with 2 params (‘Color’ and ‘Texture’), with 6 MaterialInstance (1 for each color + 1 based for specific colors), and all these 6 MI have up to 20 MaterialInstance (worst case: 1 for each texture, some textures may never be used with some colors). So there would be up to 6x20=120 usable MaterialInstance, for each texture in each color. I could then change the 5 main colors only in the 5 main MaterialInstances.
  • Problem 1: this is a lot of MaterialInstances (120 instead of 20). Would it be a performance issue?
  1. A ‘Color’ parameter (Distribution Vector Particle Parameter) in all the ParticleSystems, that I could change dynamically through code.
  • Problem 1: this is not viewable in-editor.

  • Problem 2: each of my ParticleSystemsComponents would have to go through the code that applies the color. Seems hard to manage.

  1. Dream solution: it seems the perfect solution would be a 6th Distribution mode, like a “Distribution Vector Constant* Global*”, where the constant value is not defined in the ParticleSystem itself, and referencing a value defined at a global level for the whole project. But I don’t know if this can be done, I never tried to create an UE4 plugin.

Am I missing something?

Thanks, and have a great day!