I have problem with Input.GetTouch function. In fast finger moves on touch screen, Input.GetTouch(#).position returns same value in multiple GUI updates. It’s really slow.
I need to get every exact position of touches in every GUI updates. Please help me.
When I print for example “Input.GetTouch(0).position.y” in “OnGUI” function and move my finger very fast on touch screen, console prints it for at least 7 times with the same value of for example “250”.
I built my project and exported it in to my cellphone and it didn’t help too. My cellphone has powerful CPU and graphics chip.
What can I do?
if you don’t use Update function put your code in Update function and you will never miss any thing because Update function detect the code every frame of the processor and all game developers are using Update function for getting input.
some devices are slow even their native buttons don’t response fast , your game touch detection relies on your phone touch detection.
you may also enable show touches in setting/developer options to see how fast your phone detects touches.
Input.GetTouch will be slower than what the device can detect from you finger.
You update your Unity object with asking
Input.touches. This API will need 1-2 frames latency from the actual touch the phone can report since it has to collect and process touch data before presenting them to you. Look at this recent video I made for Native Touch, I ask the yellow box on every
Update() to follow the touch, but the red box to follow the latest native touch callbacks. The result is the red box can go ahead of the yellow box by 1 frame advantage.
Remember that Unity's API is only 1-2 frames late from the callback, the improvement is at best it should not be more than 16.67ms - 33.33ms. If your touch lag feels like it is more than that I am afraid the problem might be somewhere else...
If you would like to receive native callbacks in Unity, you can try Native Touch