So I tried to make some nice clouds with particle system…
I have a texture with multiple clouds on it arranged in a grid pattern.
I select one-shot to populate the cloud with sprites instantly.
I want my clouds to be randomly chosen at creation time from the 8 clouds on the texture… but not to animate.
I tried using UV animation settings… but it cycles through my cloud textures … animating… I try setting it to only use 1 or 0 frames… but then it only ever uses frame 0
So try an alternate method… it seems like I can add more than 1 material to a particle emitter, so I make 8, using different offsets in each material to get different sprites out of the one big texture… assuming the emitter will randomly select from these 8 when generating particles… but it just uses material 1 for all of the sprites… what are all these other materials for ? there dont seem to be any paramaters to control them.
anyway… finally the question.
How can I make the particle emitter randomly select start frame, (or material…) instead of always using frame0/material0
is there some kind of script I could add ?
like onParticleCreate… ?
Never thought about doing something like that, but after going over the manual again I think you’ll need to tweak the shader a bit to use more than one material. This is by no means an answer from experience, just my thoughts from what I can see without really testing it.
You might want to maybe “hack” it a little bit.
In the reference manual it says:
And also:
You can tweak the energy through scripting giving them different energies based on your particle emitter energy settings…
Something like:
function LateUpdate () {
// extract the particles
var particles = particleEmitter.particles;
for (var i=0; i<particles.Length; i++) {
particles[i].energy = Mathf.Lerp(particleEmitter.minEnergy, particleEmitter.maxEnergy, i / particles.Length);
}
// copy them back to the particle system
particleEmitter.particles = particles;
}
ooh thanks, I’m liking that bit of code there,
seems like something like that would work well.
it also means I can get rid of those other ugly materials, and use just the one… which is probably more efficient anyway.
I’ll give that a shot tonight, and get back to you.
cheers muchly !
ok I tried that script, it seems to be running ok on the particle system… but the frames dont chnage on the clouds they all still look like frame 1.
Strangely in the editor I can see all the frames are different now… but when running the game, they are all the same.
Possibly in editor… the time just goes up slowly and the frames animate, but they are all different, but before they were all the same…
interesting…