mouse down or mouse click

Is there really any way to tell if the mouse is being held down or just clicked? I can’t really find a way to do this.

If the mouse was clicked over a 3D object I need to rotate, but if it was held down over a 3D object I need to move it with the mouse. The issue would be I don’t want the rotate to happen if the mouse is held down. I know it’s kind of a pain but the only way I can think of is to have a delay for a second or so and then check if the mouse is up or still down and treat it differently if it was.

You are correct. You will have to set up a delay and check. This is how you would implement double click as well.
If the mouse is clicked and released in x seconds, rotate, if it is still held down after x seconds move.
Input.GetMouseButtonDown(0) will return true the first frame the mouse was clicked
Input.GetMouseButton(0) will return true if the mouse button is held down during that frame.

What’s the best way to create this delay?

you can try something like:

var delay : float = 0.3;
private var clickTime : float = 0.0;

function Update () {

	if(Input.GetMouseButtonDown(0)){
		clickTime = Time.time;
	}
	if(Input.GetMouseButtonUp(0)){
		if(Time.time - clickTime <= delay){
		   print("rotate");
		}
	}
	if(Input.GetMouseButton(0)){
	   if(Time.time - clickTime > delay){
		  print("move");
	   }
	}
}

This worked, thank you very much!

This could help :

But I don’t know how to use it :sweat_smile:

This looks like the sort of thing I want to do. However, I’m using an Android device, does anyone know how to adapt the code to work for touch?