- Home /
Particle System wont play?
Okay so I have a particle system that is supposed to play when the first person controllers cameras transform is between 300 and 360. For some reason this doesnt work but the debug.log does get printed. I dont know whats going on. Im sure the script is on the right object and that the particle system has been set to rainDrops in the inspector. Any help would be appreciated, thanks.
Here's the script
using UnityEngine;
using System.Collections;
public class RainDrops : MonoBehaviour {
public ParticleSystem rainDrops;
void Start(){
rainDrops.Stop();
}
void Update () {
if (transform.eulerAngles.x >= 300 && transform.eulerAngles.x <= 360) {
rainDrops.Play();
Debug.Log("shit works");
}
else{
rainDrops.Stop();
}
}
}
Answer by Hjalte · Jul 05, 2014 at 05:32 PM
Okay I forgot to use enableEmission. heres the final script if anyone needs it: using UnityEngine; using System.Collections; public class RainDrops : MonoBehaviour { public ParticleSystem rainDrops; void Update () { if (transform.eulerAngles.x >= 300 && transform.eulerAngles.x <= 360) { rainDrops.Play(); rainDrops.enableEmission = true; Debug.Log("shit works"); } else{ rainDrops.enableEmission = false; rainDrops.Stop(); } } }
Sorry if I wasted your time.
Your answer
Follow this Question
Related Questions
Can you change the Velocity Over Lifetime of a Particle System using a Script? 3 Answers
How do I make instantiated particles inherit Transform movement from their parent object? 1 Answer
How to make an effect in a particle system so that it is always behind the sphere? 1 Answer
How do I set an objects euler rotations to match the objects transform in C#? 1 Answer
Use a single rotation axis of a freely rotating object 1 Answer