Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

UI Button for adding torque/force continuously until the button being pressed

Discussion in 'UI Toolkit' started by marirenu141, May 9, 2020.

  1. marirenu141

    marirenu141

    Joined:
    May 9, 2020
    Posts:
    2
    Hi,
    I want to use the UI button to provide the force/torque for the Gameobject(Rigidbody). Initially, I tried with the keyboard button, it worked properly. It gave the force/torque continuously until I press the key and when I release the button, the force/torque went to zero. But the same thing, I tried with the UI Button, it didn't work like previous. When I press the button, it gave discrete force/torque to the Gameobject, even after holding the button it didn't give the force/torque to the game object, It made me to click the button again and again to give the force/torque.

    Please suggest some other way to give/stop the force/torque to game object continuously until I press/release.
     
  2. BinaryCats

    BinaryCats

    Joined:
    Feb 8, 2016
    Posts:
    317
  3. marirenu141

    marirenu141

    Joined:
    May 9, 2020
    Posts:
    2
    Hi, Thanks for your support. I cracked the issue using the same button element, but with the use of the pointer up and pointer down in the event trigger.