Hello!
I can’t get positions from my touches on the screen. I get the amount of touches, but no phases or positions.
If I use the old Input, it works as intended.
Here is my code (sorry for the bad formatting, I’m writing from a phone):
Update(){
ts = UnityEngine.Experimental.Input.Touchscreen.current;
int num = ts.activeTouches.Count;
Vector2 pos3;
if(num > 0)
for(int i = 0; i < num; i++)
{
pos3 = ts.allTouchControls[num].ReadValue().position;
print(i + " " + "pos3: " + ts.allTouchControls[i].ReadValue().position);
print(i + " " + "phase: " + ts.allTouchControls[i].ReadValue().phase);
}
int num2 = Input.touchCount;
Vector2 pos5;
if(num2 > 0)
{
for(int i = 0; i < num2; i++)
{
pos5 = Input.touches[i].position;
print(i + " " + "Input.position: " + pos5);
print(i + " " + "Input.phase: " + Input.touches[i].phase);
}
}
}
What am I doing wrong?
Edit. I’m using Unity 2018 LTS and the experimental input system. (So I can get rid of the latency from the old one on Android devices.)
BR
/Lucas