- Home /
Particle System doesn't have emitter but is emitting particles
I'm using Unity 3.5, and I never really used the particle system before 3.0 was released. The 'Particle System' I've added in 3.5 seems to be a complete particle system, as described in the documentation.. Animator, Emitter and Renderer in one System attached to my Game Object. I run the game and the particles are emitted as expected, so my lack of experience with Unity's particle systems is making me second guess whether there is actually a particle emitter with the particle system that is seemingly emitting particles. The frustration comes from trying to loop through the particles in a script attached to the GameObject... the console claims that I do not have a particle emitter, even though my particle system is emitting particles.
I've tried :
Particle[] particles = transform.GetComponent<ParticleSystem>().particleEmitter.particles;
And :
Particle[] particles = GetComponent<ParticleSystem>().particles;
And :
Particle[] particles = particlesEmitter.particles;
No matter what I try, the console always says
'There is no 'ParticleEmitter' attached to the "StarsGreen" game object, but a script is trying to access it.',
Even though my particle system is clearly creating green stars on the screen. When I added the particle system, I went to the Heirarchy pane, clicked on the "Create" dropdown, and added a particle system. I checked Emission and particles are being emitted, I just can't figure out how to access that emitter via code.
@emorobot I dont think it is implemented yet. I havent done the recent update, but from what ive tried on my system (3.5.1) it is not possible. The type will be ParticleSystem.Particle[] that much is clear from the ref if you look at GetParticles and SetParticles. I looked at those, GetParticles returns an int so my guess is its co$$anonymous$$g... Thats a bummer. I tried the same thing as your first example and it compiled like it was gonna work, but when you actually try to get the array you get the error...so yeah. I hope they expose some more of the ParticleSystem in general, i wanted to change the shape today dynamically but thats a no go as well.
I came across this example in my searching, thought I'd share. It doesn't answer my question directly, but gives me enough to find a work-around to solve my problem, hopefully it helps you too.
Answer by Bunny83 · Jun 04, 2012 at 10:36 AM
It actually looks like you're mixing the two different particle engines here. ParticleSystem is the new one (Shuriken). The ParticleEmitter is the old one. They have actually the same purpose. Those components are responsible for emitting and manage particles. I haven't used the new one yet, so i'm not sure if it has everything in one component, but don't mix the components up ;)
From what i can see in the scripting reference the new Shuriken system has the animator integrated since the ParticleSystem has a gravityModifier so i guess it's animatng the particles itself.
edit
It looks like those should be grouped:
Shuriken:
ParticleSystem
ParticleSystemRenderer
ParticleSystem.Particle
The the old system:
ParticleEmitter
ParticleAnimator
ParticleRenderer
Particle
Your answer
Follow this Question
Related Questions
Particle System not working properly? 1 Answer
Particle delay 1 Answer
Two Particle Systems 1 Answer