For several parameters, Shuriken is giving different ways to affect it in the editor : constant, curve, random, gradient etc. However, by script you can only affect a constant value, like for instance :
Is there some secret ninjas ways to do that, or do I need to do every frames :
As we are talking, among other things, about Shuriken's random stuff, here is an interesting paper (unrelated to the issue here, and yet kind of, as the result above won't be similar to the builtin one, because the random value is re-sampled, thus not connected).
Shuriken is a curiously dark box when looked at from a scripting perspective -- there are many parameters you can manipulate in the editor that are not accessible from script, even things as simple as the size of the emitter.
The best Secret Ninja Sauce(TM) I've found is to use the editor to create an animation that animates a particle system property from a minimum value at the start of the animation to a maximum value at the end of the animation, then from your script you can update the animation state using normalizedTime to select a value between min and max (0 for min, 1 for max).
You can get the animation state like this (probably best to do this in Awake or Start) ...
And then set your value to (say) halfway between min and max with ...
You can set up a bunch of animation states, one for each parameter (or set of parameters) that you want to procedurally control.
It's a little indirect, but it does give you scripted control of anything you can see in the Shuriken editor.
answered Jun 23 '12 at 06:11 AM