I have three 2D buttons in the GUI - left, right, up. And I need to implement simultaneous button presses. Well, for example, simultaneously press the 'right' and 'up' (Jump), that would simultaneously move to the right and jump. I ask those who know to throw off the code itself, just as in theory I know how to do it. Here is an example of code that I found on the forum How to implement Multi Touch for Unity Android (It is attached to the buttons in the Update cycle and it did not work for me).
//C# using UnityEngine; using System.Collections; public class MobileInput : MonoBehaviour { public void Update() { //Касания Touch[] touches = Input.touches; //Цикл for (int i = 0; i < touches.Length; i++) { Touch touch = touches[i]; if (touch.phase == TouchPhase.Began) { Ray ray = Camera.main.ScreenPointToRay(touch.position); RaycastHit hit; Debug.DrawRay(ray.origin, ray.direction, Color.cyan); //Рейкаст if (Physics.Raycast(ray, out hit, 100)) { if (hit.collider.gameObject.tag == "Fruit" && !Values.gamePaused) { } } } } } }