- Home /
Question by
3D_Game_maker · Oct 09, 2016 at 02:15 PM ·
particlesparticle systemparticle
Trying to change a particle system on and off with a toggle
So heres my script
using UnityEngine; using System.Collections;
public class Rain : MonoBehaviour {
float times = (Random.Range (
60,
200
));
void Start () {
}
// Update is called once per frame
void Update () {
times -= Time.deltaTime;
if (times < 0) {
times = (Random.Range (
60,
200
))
}
}
}
i'm trying to make a particle system turn on and off every time the variable times runs out and is recharged. Does anyone know how to do this?
Comment
Try:
ParticleSystem ps= GetComponent();
if(isPaused){
ps.Play(true);
}
if(isPlaying){
ps.Pause(true);
ps.Clear(true);
}