- Home /
Making 2D On screen buttons for movement
I'm making a top down game for mobile devices. This is what I made so far:
if(GUI.Button(new Rect(20, Screen.height - (150*2 + 20), 150, 150), btnUp)){
rigidbody2D.AddForce(Vector3.up * 10 * Time.deltaTime);
print("I'm pressed");
}
The thing is just that the player only moves 1 frame each time I press the button, which isn't optimal at all.
I can't figure out how to make the player move while using the on screen buttons. How is that possible?
Comment