Синтаксис:
Используется csharp
// объявленные переменные
if(Input.touchCount >0)
{
Touch touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Began)
{
Vector3 touchPosition = Camera.main.WorldToScreenPoint(touch.position);
Instantiate(_newBall, touchPosition, Quaternion.identity);
Debug.Log(touchPosition);
}
}
if(Input.touchCount >0)
{
Touch touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Began)
{
Vector3 touchPosition = Camera.main.WorldToScreenPoint(touch.position);
Instantiate(_newBall, touchPosition, Quaternion.identity);
Debug.Log(touchPosition);
}
}
Я хочу спавнить некий объект в точке куда тапнул на телефоне, однако у меня неправильно высчитывается позиция тача.