// Shoot a ray whenever the user taps on the screen var particle : GameObject; functionUpdate () { for (var i = 0; i < Input.touchCount; ++i) { if (Input.GetTouch(i).phase == TouchPhase.Began) { // Construct a ray from the current touch coordinates var ray = Camera.main.ScreenPointToRay (Input.GetTouch(i).position); if (Physics.Raycast (ray)) { // Create a particle if hit Instantiate (particle, transform.position, transform.rotation); } } } }