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

Touch screen interactions

Discussion in 'UI Toolkit' started by XB23, Jun 9, 2022.

  1. XB23

    XB23

    Joined:
    Sep 12, 2018
    Posts:
    20
    Hello everybody, I really need help to make touch works in my project.

    My project is for windows, I already know how to make buttons in my UI and it is great
    {
    VisualElement ButtonA= root.Q<VisualElement>("name");
    ButtonA.RegisterCallback<PointerDownEvent>((e) => Method());
    }
    but it only works when I click with the mouse, I can not interact with touch inputs.
    I downloaded the UI-toolkit sample (1.0.0- preview.18 , my unity's version is 2020.3.24f, I don't know if it is the problem) but in the file "TouchMove.cs" I only see the same way as I already did.

    There is no example scene in the UI-toolkit sample so maybe I made a mistake by creating a new scene and trying the "Events_TouchMove" visual tree asset.

    I did not mention it but I tried in play mode and build. I hope someone as a solution for me, thanks for reading.
     
    Anubis_V2 likes this.
  2. XB23

    XB23

    Joined:
    Sep 12, 2018
    Posts:
    20
    Update: I don't know how/why, OnPointerUp seems to work (I founded and tested it in the Pointer Event example) but OnPointerDown still don't do the job.