Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Multitouch disabled for UI only

Discussion in 'Unity UI & TextMesh Pro' started by KristoE, Mar 23, 2015.

  1. KristoE

    KristoE

    Joined:
    Oct 13, 2012
    Posts:
    88
    Hi,
    I was wondering if there is a way to disable multitouch for the UI elements only?
    What I am trying to achieve is use the pinch functionality to zoom in the game, but I don't want the UI elements to stay in the way and trigger.
    The scenario I am looking for is that once you touch the screen with your second finger it would stop sending events to the UI elements.
    Is there a simple way of doing this?

    Thanks in advance
     
    Shahab-Mirza likes this.
  2. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,597
    It's Ironic really but the UI started out single touch only and was updated to support multi-touch.

    There isn't a way using the shipped input modules to restrict touch count, however you can take a copy of the TouchInputModule and change it to be single touch again (or preferably with an editor option to make it single / multiple :D). THen use your new version attached to the event system instead of the default one.
    You can see the code for the Input Modules here:
    https://bitbucket.org/Unity-Technol...ityEngine.UI/EventSystem/InputModules/?at=4.6
     
  3. KristoE

    KristoE

    Joined:
    Oct 13, 2012
    Posts:
    88
    Thanks for the reply, not sure I'll be creating a alternative input module as my project is still in very early production phase and the UI controls are likely to change. Was hoping there was a one line code solution or something, but it seems there isn't.

    Thanks anyways.
     
  4. Shahab-Mirza

    Shahab-Mirza

    Joined:
    Aug 23, 2016
    Posts:
    3
    Today , I am having the same problem . I wanna to disable multi touch on my UI elements but want to Pinch on multi touch. Did you find any solution ?