- Home /
Question by
kqmdjc8 · Jan 03, 2019 at 08:44 PM ·
particlesbeginnerparticlesystem
Simple particles problem
Hello, I wrote this simple script to emit particles while I'm overlapping a trigger. It does work, however if I touch trigger for really short period of time (like touch it, wait 0.1 sec and leave it) it completly messes up and doesn't work at all until I restart the game.
public class ParticleControll : MonoBehaviour
{
public Transform part1;
void Start()
{
part1.GetComponent<ParticleSystem>().enableEmission = false;
}
void OnTriggerEnter2D()
{
part1.GetComponent<ParticleSystem>().enableEmission = true;
}
void OnTriggerExit2D()
{
part1.GetComponent<ParticleSystem>().enableEmission = false;
}
}
Particle menu shows that emition is enabled but It doesn't emit particles after I do thing mentioned above.
Comment
Best Answer
Answer by kqmdjc8 · Jan 04, 2019 at 01:12 PM
Found answer by myself, solution was to use part1.Play() and part1.Stop()
also, remember to change part1 type from Transform to ParticleSystem