/ Published in: C#
On Touch down .. attach this script in Main Camera
Expand |
Embed | Plain Text
using UnityEngine; using System.Collections; public class OnTouchDown : MonoBehaviour { void Update() { // Code for OnMouseDown in the iPhone. Unquote to test. for (int i = 0; i < Input.touchCount; ++i) { if (Input.GetTouch(i).phase.Equals(TouchPhase.Began)) { // Construct a ray from the current touch coordinates Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(i).position); if (Physics.Raycast(ray, out hit)) { hit.transform.gameObject.SendMessage("OnMouseDown"); } } } } }
You need to login to post a comment.
