- Home /
How to constantly add force to my player when a button is hold?
Hi, I want to constantly add force to my player when a button is hold. The problem is that force is added only once (when i click), but I want to keep adding force as long as the button is hold.
Answer by akwasikonadueverlasting · Aug 25, 2020 at 12:01 PM
Hi @dharmesh27 use if(input.GetKey(KeyCode."put your own key here")) { Do your stuff here }
Answer by Llama_w_2Ls · Aug 25, 2020 at 01:34 PM
You need to add the event system component onto your button. This will allow you to run functions OnPointerHeld, or OnDrag, etc.
Your answer
Follow this Question
Related Questions
Adding Force with a GUI button 5 Answers
AddForce adding together on 2 button presses 1 Answer
Start Button 2 Answers
AddForce forward also adding downward force 0 Answers
Unity 5.0.2f1 UI Button OnClick Function 6 Answers