Return to Snippet

Revision: 68899
at March 13, 2015 21:59 by vishnuajit


Initial Code
if(Input.touchCount == 1 && Input.GetTouch(0).phase== TouchPhase.Began)
		{
			Vector3 pos = Camera.main.ScreenToWorldPoint (Input.GetTouch(0).position);
			RaycastHit2D hit = Physics2D.Raycast(pos, Vector2.zero);
			if (hit != null)// && hit.collider != null) 
			{
			//	Debug.Log ("I'm hitting "+hit.collider.name);
				status.text = "hit on"+hit.transform.gameObject.name;
				}
			
		}

Initial URL

                                

Initial Description
detect touch input on unity 2D android device

Initial Title
detect touch input on unity 2D android device

Initial Tags

                                

Initial Language
C#