I’ve been trying to make a simple static mesh object that has a particle system attached, which will be activated by some event (say like on any damage received).
To add variety, I added MID to both the static mesh and the particle, using the construct graph. Both materials are simple, the SM material has one vector parameter node linked to base colour; and the emitter material is additive and has one vector parameter linked to emissive colour. And then in the event graph I set up this event to test it, on G pressed, change both MID to one random colour; then on F pressed activate the particle.
The result is that when I press G the SM changes colour properly, but when I press F the particle activates and it’s still the default colour.
I’ve tried particle parameter but it didn’t work either…
You will need to call a Set Material to the Created MID on your Particle System on Event Begin Play, otherwise the Particle will not accept the new Material from the Construction Script.
Awesome! Thanks Eric! This indeed solved my problem and worked on both CPU and GPU sprites! Just out of curiosity, can I do this with particle parameter? Is there something to pay attention to using the parameter method?
If you are wanting to use a Particle Parameter, You will need to use Particle Color in your material and then setup an Initial Color Module to use a Vector Parameter (drop the ColorOverLife module). The setup would be the essentially the same in Blueprints without the need to make a MID for the Particle System.
There is a great series by one of Epic’s Senior VFX Artist Tim Elek on our Wiki, I would highly recommend reading through them:
Thanks for the link. I’ve read those lessons before and I’ve had quick read again but just couldn’t find where I did wrong.
Would you take a look at my settings if it’s not too much trouble? I’ve put the bp event graph and the detail panel of the particle system in bp in the question and here are the particle material and the initial colour setting of my particle system.
Your Material and Cascade Setup look correct (though I might change the Constant RGB to 1,1,1 - more for preview purposes than anything else). I don’t see your Event Graph. If you can post that for me I will take a look
got the exact same problem but in c++.
using a material with only particle color as input and trying to modify the distributionvectorparameter from code after creating a particlecomponent by SpawnEmitterAtLocation.
turns out the particlecomponent doesnt react on setvectorparamter / setcolorparamter and wont give any results for getvectorparamter/getcolorparamter either.
the paramter is just not to be found within the particlecomponent. is there anything i have to call to init the params for me to edit?
I should note here as well that using Initial Color with GPU Particles is still a known issue as of 4.11 Preview 6.
However there is a workaround:
Set your Initial Color Module to a
Constant 1,1,1
Add a Scale Color / Life Module
In the Color Scale Over Life set the
Distribution to Vector Particle
Parameter
Name your parameter in Parameter
Name
Under Param Modes set the 0,1 and 2
all to DPM Direct
If needed, set the Constant RGB
values to 1,1,1 (will not affect
outcome.)
You should now be able to control the Particle Parameter in your Blueprints. Remember you can also stack the same module more than once, so you can add another Scale Color / Life Module to control overall behavior over the particles life, if required.
I have attached a sample project below showing the setup mentioned above.
its working like you are describing above in the editor. in a cooked build it doesnt work for me, the color stays the same and you cant change it on runtime. futhermore its like having color over life but i really need initial Color. the born partical should get it color from a bluescript value and keep it over its lifetime.