- Home /
ParticleSystem.play in unity 5?
I can't get the particle system to work on the new unity, I've looked everywhere and found that it has to be GetComponent< ParticleSystem>() but I can't get it to play, I've tried gunBarrel.GetComponent< ParticleSystem>.Play(); and lots of others but it wont work...
It's for a shooting script I have, how do I get it to play?
============ Have to put a space in < ParticleSystem> because text vanished if I didn't
Answer by ticofa · May 14, 2015 at 04:33 AM
Hi :)! When scripting particle systems i tend to use:
*object in question*.GetComponent<ParticleSystem>().rateOfEmission = *some value*
or
public ParticleSystem *some Variable*
*some Variable* = GameObject.Find("*object in question*").GetComponent<ParticleSystem>();
*some variable*.rateOfEmission = *some value*
for example:
If(condition is met)
{
this.particleSystem.rateOfEmission = VALUE;
}
else
{
this.particleSystem.rateOfEmission = 0;
}
I hope It Helps ^_^
Type UnityEngine.ParticleSystem' does not contain a definition for
rateOfEmission'
You sure this works for unity 5?
Your answer
Follow this Question
Related Questions
How to destroy a clone of an effect attached to an object? 1 Answer
GameObject keeps acting like gameObject. 1 Answer
ParticleSystem at Photon Not working! 2 Answers
Customising Particle Effects for exploding rocks?? 1 Answer
Any suggestions to learning the in's and outs of the particle system? (list of sources) 1 Answer