Код: Выделить всё
//Check if Input has registered more than zero touches
if(Input.touchCount > 0){
//Store the first touch detected.
Touch myTouch = Input.touches[0];
//Check if the phase of that touch equals Began
if (myTouch.phase == TouchPhase.Began)
{
//If so, set touchOrigin to the position of that touch
touchOrigin = myTouch.position;
if(touchOrigin.x < -2){
horizontalInput = -1;
} else if(touchOrigin.x > 2){
horizontalInput = 1;
}
if(touchOrigin.x > -2 && touchOrigin.x < 2 && touchOrigin.y < 0){
verticalInput = 1;
}
} else if(myTouch.phase == TouchPhase.Ended){
horizontalInput = 0;
verticalInput = 0;
}
}
Когда я попробовал его на моем телефоне Android, он перемещался только вправо, и я не знаю, почему.
(положение моей камеры: x: -6,6; y: -2,6) и я использую орфографическую камеру
Подробнее здесь: https://stackoverflow.com/questions/319 ... on-android
Мобильная версия