Emit particles on key press- particle system - Unity3D - C#

using UnityEngine; using System.Collections; public class Particle_Burst_Control_Keypress: MonoBehaviour { public int particleBurst = 80; ParticleSystem ps; void Start() { ps = GetComponent<ParticleSystem>(); } void Update() { var em = ps.emission; if (Input.GetKeyDown(KeyCode.A)) { ps.Emit(particleBurst); } } } // easy unity code by Josiah Munsey 26PM
Place this script on a particle system.
When you press the "a" key it will burst the number of particles specified ( default 80 ).
Set the "emission rate over time" to 0 on the particle system for most obvious results when you key press.
--------------------
Unity 3D Emit particles on key down

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.