- Home /
Question by
Elit3d · Feb 16, 2014 at 11:01 PM ·
mouseupdatefunction updatedown
Mouse Hold Down
So basically, when I hold my mouse button down, I want the timer to increase until it hits a certain time, however, it is only working if I click it, any ideas?
var chopTime = 0.0;
function Update ()
{
if (Input.GetMouseButtonDown(0))
{
//increment holdBreathTicker by deltaTime
if (chopTime < 10)
{
chopTime += Time.deltaTime;
}
}
}
Comment
Best Answer
Answer by getyour411 · Feb 16, 2014 at 11:10 PM
Use GetMouseButton
Thanks a lot! I am so silly for making such an easy mistake
Answer by Rispat-Momit · Jul 26, 2019 at 05:30 PM
You can also use:
void OnMouseDrag()
{
///anything you want to do
}