How to Long press or Hold a GUIButton?

Hello Everyone,

Thanks for helping me out with all of my newbie problems.

I am trying to rotate an object and I’m rotating this object using multiple buttons (Eg. Up, Down, Left and Right).

But the problem that I am going through is, I will have to press the button again and again to rotate the object. Eg. If I want to rotate an object in Upwards direction then I will have to press this button again and again. I didn’t find any long press event or any event related to holding of the button?

Thanks,
Lokesh Sehgal

I used this and it works flawless

while (GUI.RepeatButton(new Rect(15, 100, 100, 50), "Backward") ){
			transform.position += new Vector3(0, 0, -0.5f);
	}

Did you even look at the scripting reference?

GetButton	 Returns true while the virtual button identified by buttonName is held down. 
GetButtonDown	 Returns true during the frame the user pressed down the virtual button identified by buttonName. 
GetButtonUp	 Returns true the first frame the user releases the virtual button identified by buttonName.