- Home /
Particle EmitParam for Custom Data
In the docs, there's SetCustomParticleData, but this is to set it to all existing particles. In the example they also show how to assign unique ID for each particle, but again, only for already emitted particles. I'd like to set custom data each time before i Emit(), which would most likely be inside EmitParam.
Previously i had problem with setting startSpeed for each particle because there's no such thing in EmitParam (only velocity, but it's different). The workaround is to modify particleSystem.main.startSpeed each time before i Emit, and it works. Even in a single frame, each Emit() done after a modified startSpeed gets different startSpeed.
Doing the same with CustomData module doesn't work. In fact, changing the values in CustomData module would change all particles already emitted. I understand turning the module off is the way to set it manually with SetCustomParticleData, but i need to control it before each Emit, not after it's already out.. Cheers
Answer by richardkettlewell · Aug 08, 2019 at 07:45 PM
It’s not possible to control this before emission. You must Emit first. You can do it in the same frame before it is ever rendered in a few ways: by calling Emit from script followed by Get/SetCustomParticleData, or by using default emission and using the Get/Set in LateUpdate, or, the best way, is in 2019.3 to use the c# job system to modify the data really efficiently, instead of the slower methods I previously mentioned.
Your answer
Follow this Question
Related Questions
Tornado physics 4 Answers
How to make physics collision dotted simulation like bubble shooter ? 2 Answers
Make Shuriken Particle System lock on to a target 0 Answers
Break 3D Object into Pieces 2 Answers
Water physics in solid object 2 Answers