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. Dismiss Notice

Touch Input Support

Discussion in 'UI Toolkit' started by MousePods, Oct 25, 2020.

  1. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    740
    Hi,

    I was wondering when touch support is going to be implemented into UIToolkit? I added a few buttons into my game and they work in the editor. However, when I build to my iOS device, the buttons are unresponsive.

    Code (CSharp):
    1. root.Q("button-circle").RegisterCallback<MouseEnterEvent>(ev => GameManager.instance.SwitchShape(Shape.circle));
    Thanks!
     

    Attached Files:

  2. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,256
    For touch use PointerEnterEvent not MouseEnterEvent.
     
  3. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    740
    Thanks for the hint! Unfortunately, there are some bugs with it.

    If you use OnPointerDown, for some reason it will register twice and then, if you move the mouse while holding the mouse button down, it registers a third time.

    I reported the bug. Here is a video of the issue:


    EDIT: Case #: 1287927
     
    Last edited: Oct 26, 2020
    Midiphony-panda likes this.
  4. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,256
    Yeah I had some issues with mobile touch and rendering on some older devices. I decided its best to leave it alone for that right now. Got it working good for a card game done entirely with it and an inventory drag and drop system though.
     
    MousePods likes this.