How do you make a particle effect play on a key press?
I'm trying to do a simple single-scene project, but I'm having trouble coordinating the snow particle effect start time because it seems like the prefab's start time is linked to the framerate and doesn't always play accurately. I figured I'd just set it up manually with a button press, but I'm new to Unity and not very good at scripting and it seems like every answer I've found on the subject involves already having a scripting system in place, which I don't have because I don't need. The only simple script I was able to find was this
if (Input.GetKeyDown (KeyCode.R)) { ParticleSystem.enableEmission = true; } else { ParticleSystem.enableEmission = false; }
but when I put that into a javascript file it just says "An instance of type 'UnityEngine.ParticleSystem' is required to access non static member 'enableEmission'." Can anyone help in a way that isn't overly complex?
Your answer
Follow this Question
Related Questions
accessing the colliding particle 0 Answers
Intersecting edge colliders cause particles to pass through one edge collider? 1 Answer
Emit Particles in 45 degree steps ? 1 Answer
is it a necessity to use particles effect in a game? 2 Answers
For the particle system, making my stars is an issue as the script command calls are now obsolete. 0 Answers