- Home /
How do I modify duration time of a particle system at runtime?
Hello community, I am having problem modifing the duration of particlesystem (which I have reference to). I've tried the method that is used in many examples and most importantly in the official documentation.
So this is what I've tried: (particleTemplate is the gameobject the particle system is attached to)
ParticleSystem ps;
ps = particleTemplate.GetComponent<ParticleSystem>();
ps.Stop(); // Cannot set duration whilst particle system is playing
var main = ps.main;
This is the error that occurs:
'UnityEngine.ParticleSystem' does not contain a definition for 'main' and no extension method 'main' accepting a first argument of type 'UnityEngine.ParticleSystem' could be found (are you missing a using directive or an assembly reference?)
Well, obviously the ParticleSystem doesnt have a variable 'main' or I dont have accsess to it, so are the documentation outdated? And most importantly - how do I modify duration time of a particle system at runtime?
Answer by ifurkend · Aug 19, 2017 at 05:04 AM
Probably you're using Unity older than 5.3, if so you should look at legacy documentation.
Your answer

Follow this Question
Related Questions
Enabling the particle system with particle.Play(); not working 2 Answers
Stretched Particles Billboard 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
ParticleSystem not rendering after changing startColor 1 Answer