常用小语法

长按Press 判断

private float _longClickDuration = 2f;
float _lastPress = -1f;
void OnPress(bool pressed) 

if (pressed) 
_lastPress = Time.realtimeSinceStartup; 
else 

if (Time.realtimeSinceStartup - _lastPress > _longClickDuration) 
DoLongPress(); 

}

你可能感兴趣的:(常用)