I’m using Unity 4, working on an Android game. When I put the following code at the beginning of my Update function:
myGUI.text = Input.touches[0].phase + "";
it works perfectly, prints Moved when I move my finger, prints Stationary when I don’t, etc. myGUI is a GUIText object.
But when I put that same snippet of code after this code:
if (Input.touches[0].phase == TouchPhase.Began) {
if (Input.touches[0].position.y < scrnW/2) {
rightTouchNum = 1; }
else if (Input.touches[0].position.y > scrnW/2) {
leftTouchNum = 1; }
}
else if (Input.touches[1].phase == TouchPhase.Began) {
if (Input.touches[1].position.y < scrnW/2) {
rightTouchNum = 2; }
else if (Input.touches[1].position.y > scrnW/2) {
leftTouchNum = 2; }
}
It won’t return anything but Began. Why is this?? How can I possibly be altering the results of touchphase with these if statements? rightTouchNum, leftTouchNum and scrnW are all just integers.
I’ve attached my code for good measure. Thank you!
did you put your app in background then resume when you tested that ?
because there is an issue right now where when app resume fingerId returned never get back to 0 ( it return whatever number but not 0 it seem ) which completely break code that check for that “0” id if you have some.
have issue with this using finger gesture as well , so that may be the cause of your problem…
Thanks for the response! I’m not quite sure what you’re saying though… I didn’t put my app in background. Do you know how I might be able to fix my problem? Is it a bug within Unity?