using System.Collections; using System.Collections.Generic; using UnityEngine; public class MouseHelper : MonoBehaviour { protected bool _isDown=false; protected virtual void _MouseDown(){ } protected virtual void _MouseUp(){ } //毎フレーム読んでね protected void _CheckMouse(){ if(Input.touchCount >= 1){ var touch = Input.touches[0]; if( touch.position.x < Screen.width - Screen.width*0.2f ){ if (touch.phase == TouchPhase.Began){ _MouseDown(); } if (touch.phase == TouchPhase.Ended){ _MouseUp(); } } } #if UNITY_EDITOR if(Input.GetMouseButtonDown(0)){ _MouseDown(); } if(Input.GetMouseButtonUp(0)){ _MouseUp(); } #endif } }