So I know for iPhone theres tapCount or touchCount, but is there anything like that for pc/mac version of unity? like for double tapping a button? I tried a timer but I just can’t get it to work (I know I’m probably doing something wrong with the timer).
I dont know for the other versions but a simple double tap script.
float m_fLastPress = 0.0f;
void Update()
{
if( click event )
{
float fCurrentTime = Time.timeSinceLeveLoad;
if( fCurrentTime - m_fLastPress < 0.000001f ) // Or whatever you want
{
// Double click
}
m_fLastPress = Time.timeSinceLevelLoad;
}
}
Thanks, but do you think you could post that in, I don’t know any c#. Thanks
I dont know JavaScript, i refuse to learn it. Sorry.
Im sure someone else could convert that in seconds.
Ok, I’m sure I can figure it out, thanks.
Just replace types like float with var
and the return type of void to function. Im sure theyre the only differences in that code.