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

how do I change a Button State - Pointer Up/Down button while holding another down?

Discussion in '2D' started by TK_Development, Apr 28, 2019.

  1. TK_Development

    TK_Development

    Joined:
    Mar 10, 2019
    Posts:
    6
    Hey Guys i need help,

    i have two Buttons, Button Left and Button Right.

    Each Button has an Event Trigger with Pointer Down and Pointer Up
    -> my Player can walk in both directionn without any Problems

    My Problem is:
    when i press and hold one Button like Button Left, my Player walks left BUT if i still hold the button pressed and slip over to the walk right Button it doesnt work and the Player still walks left until i make the Pointer Up and down with my finger.

    Do you have andy Ideas how to change the Button while pressing?
    Is there any way to make this work with this Methods?
    Should i swtich to controll the Buttons over touchcount, gettouch [....] ?

    Thank your for your help!
     
    Last edited: Apr 28, 2019
  2. TK_Development

    TK_Development

    Joined:
    Mar 10, 2019
    Posts:
    6
    My solution was to combine the OnPointerDown and OnPointerUp with the OnPointerEnter and OnPointerExit in my Script.
    With that tools i checked all possible States from Buttons and created the movement for the pressed Button slide move.