So I made a little game that has a problem. As soon as I load the game, I get errors. **Lots of them.**![alt text][1]
[1]: /storage/temp/77497-theerror.jpg
I can't seem to find the problem in this code:
//This is where the exception is
Touch touch = Input.touches [0];
float TouchTime;
if (touch.phase == TouchPhase.Began) {
TouchTime = Time.time;
}
if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled) {
if (Time.time - TouchTime <= 0.5) {
//response to tap
print ("");
}
else {
print ("Long press was" + TouchTime + "seconds long.");
}
}
Also this was in the `update()` method, which might explain the huge number of errors, but how do I fix this?
↧