- Home /
Shuriken Particle System GetParticles() not working
I am trying to get a effect like the old "rotation axis" in the new Shuriken particle system.
If there is a easy method for this please tell me.
My approach to solve this problem was to write a script, which changes the velocity of every particle, but it seems as if GetParticles() does not work for me.
Now the real question: How do I have to use this method?
Thats strange, I haven't seen that method anywhere and I can't get it from anything.
Not even the scripting reference shows this method anywhere?
Answer by WBDN · Dec 30, 2011 at 10:45 PM
Example script that will make all particles red:
public class ParticleBufferAccess : MonoBehaviour {
private ParticleSystem.Particle[] particles = new ParticleSystem.Particle[1000];
void LateUpdate() {
int length = particleSystem.GetParticles(particles); int i = 0;
while (i < length) {
particles[i].color = Color.red; i++;
}
particleSystem.SetParticles(particles, length); }
}
Answer by oriolmanya · Jul 12, 2016 at 12:16 PM
Thanks @WBDN, I was trying to move particles in other ways but GetParticles(particles) always returned "0", so no particles at all.
Finally the solution was to allocate space for the particles on declaration:
private ParticleSystem.Particle[] particles = new ParticleSystem.Particle[1000];
This is hidden in the bottom in Unity's documentation example, so it would be great if you improve it a little bit :)
[https://docs.unity3d.com/ScriptReference/ParticleSystem.GetParticles.html]
Answer by metervara · Mar 22, 2012 at 01:46 PM
I've noticed that there's a delay before the GetParticles() function has any particles available, that might be why there's no particles? I got it working by emitting in Start() and then getting particles in Update().
Your answer

Follow this Question
Related Questions
Track Quaternion local Y axis to position 1 Answer
Why is rotation offset 1 Answer
Using Camera screen point to ray for look rotation problem... 1 Answer
Vector3 - Rotate a cube by its spatial (longer) diagonal 1 Answer
ARCore - Lean touch- Use Lean Custom Rotation script to limit the rotation only in Y axis 2 Answers