Answer the question
In order to leave comments, you need to log in
How to make a finger touch registration area?
There is this code:
private void Touches()
{
if (Input.touchCount == 1)
{
foreach (Touch touch in Input.touches)
{
switch (touch.phase)
{
case TouchPhase.Began:
if (_touchId == 0)
{
_touchId = touch.fingerId;
}
break;
case TouchPhase.Moved:
var delta = Mathf.Clamp(touch.deltaPosition.x, -_sensitivityLimiter, _sensitivityLimiter);
_velosity += _sensitivity * delta * transform.right;
break;
case TouchPhase.Canceled:
case TouchPhase.Ended:
transform.eulerAngles = new Vector3(0, 0, 0);
_touchId = 0;
break;
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Create UI > Button, stretch as needed, hide the image.
Or I do through the picture. I create an Image and attach an Event Trigger to it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question