Unityのクイックダブルタップタッチ機能



Unitys Quick Double Tap Touch Function



キューブスクリプト:

using System.Collections using System.Collections.Generic using UnityEngine public class DoubleTouchTest : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { //Judge whether to click, click to enter the if branch if (Input.GetMouseButtonDown (0)){ //Set a ray Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition) //Set the return value of receiving rays RaycastHit hitInfo //If the ray hits an object, return true and enter the if branch if (Physics.Raycast (ray, out hitInfo)) { //When a finger touches and just started to touch, enter the if branch if (Input.touchCount == 1 && Input.GetTouch (0).phase == TouchPhase.Began) { //When the second touch, enter the if branch if(Input.GetTouch (0).tapCount == 2){ //Make the object hidden hitInfo.collider.gameObject.SetActive (false) } } } } } } https://jingyan.baidu.com/article/9989c746eedeeef648ecfe0c.html