i make a button where if i press it , it calls a function that move my player on x-axis , but when i click button my player move a bit and stop , that because the function is called on one click where if i hold the button my player doesnt move
is their a clear code for solving this problem ?
@Zephire ,i make button which when pressed a function is called where player moves on x-axis but my player is moving only by one click where if hold down the button my player doesnt move
Hi,
It sounds like you are using Input.GetMouseButtonDown
Try using Input.GetMouseButton.
GetMouseButtonDown will only execute once until you release it and push the button again, GetMouseButton will execute with each frame as long as the button is being held down.
Hope this resolves for you.