- Home /
Question by
Greg_Froning · Jun 28, 2014 at 09:20 PM ·
c#androidtouch
Touch Not Working
I have the following code for testing my buttons which will be used for player movement, but they are not registering hits. I have a main camera, then a second camera for orthographic projection. The hits are not being registered though.
using UnityEngine;
using System.Collections;
public class mobileMove : MonoBehaviour {
void Update()
{
if (Input.touchCount > 0)
{
for (int i = 0; i < Input.touchCount; i++ )
{
if ( this.guiTexture.HitTest (Input.GetTouch(i).position ))
{
if ( Input.GetTouch(i).phase == TouchPhase.Began )
{
Debug.Log("The touch is down on " + this.name );
}
if ( Input.GetTouch(i).phase == TouchPhase.Ended )
{
Debug.Log ("The touch has ended " + this.name );
}
}
}
}
}
}
Comment
Have you tried using breakpoints to see if you're getting any touches to begin with?
Your answer
Follow this Question
Related Questions
Weird issue with first-time effect call on Android 0 Answers
Stopping rotation at 90° and -90°/270°. 0 Answers
how use specific for mobile button when we have 3 ? 1 Answer
C++ windows DLL and Android? 1 Answer
Smooth Follow Camera Rotate on Z-Axis? 2 Answers