Hi
I’ve found answer:
Hey there, this problem sounds pretty easy to solve, but.... I don't get it. I want to have a kind of loop that counts up the variable "acceleration" WHILE the space bar is pressed.And them when it is not pressed anymore I want to add a relative...
and I try do do in similliar way.I have inside OnGUI():
GUI.Button(new Rect(xOffset,yOffset,buttonWidth,buttonHeight),"LEFT");
and inside Update():
if(Input.GetButton("LEFT")) transform.Rotate(0,20*Time.deltaTime,0);
but that does not work Why?
save
July 2, 2011, 12:26pm
3
The RepeatButton does the trick:
if (GUI.RepeatButton(Rect(xOffset,yOffset,buttonWidth,buttonHeight),"LEFT")) {
//repeating code
}
Waz
July 2, 2011, 11:49am
2
Your two pieces of code are completely unrelated. In the default Unity text editor, highlight GUI.Button and press F1. Read that. Then do the same for Input.GetButton