Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Tuism · Mar 12, 2018 at 01:51 PM · touch controlstouchscreenmultitouchtouches

Multitouch second touch interrupts first, BUT is fine if the first touch is the third touch. WHAT!?

Hi all

I'm working on an Android touchscreen game. Left side of the screen steers, right side of the screen has buttons that do other stuff. Seems straightforward enough.

What I have: Left touch steers, but when I touch the right side, the first touchpoint is interrupted. The fingerId is still maintained, but moving that finger no longer updates the input number.

Bizarro behaviour: If I put two or more fingers on the screen FIRST (to the right of the screen), then start steering on the left side, THEN add more touch points on the right, the steering does NOT get interrupted. One finger first doesn't prevent the interruption, only two or more.

The last line is a debug that tracks the number of fingers on the screen and the fingerId of the movement finger. Both numbers track correctly.

Why!??! Help!!! Thanks!!!

My code:

 for (int i = 0; i < Input.touches.Length; i++)
         {
             //if no fly finger assigned and touch is on the left side
             if ((flyFingerId == -1))
             {
             if (Input.GetTouch(i).position.x < Screen.width/2)
                 {
                 switch (Input.GetTouch(i).phase) 
                     {
                     case TouchPhase.Began:
                         // code to run when touch begins here...
                         controlType = UseControlType.Mouse;
                         touchPointStart = Input.GetTouch(i).position;
                         flyFingerId = Input.GetTouch(i).fingerId;
                         break;
                     }
                 }
             } else
                 if (Input.GetTouch(i).fingerId == flyFingerId)
             {
                 switch (Input.GetTouch(i).phase)
                 {
                     case TouchPhase.Moved:
                     case TouchPhase.Stationary:
                     // code to run when touch is being dragged here...
                     touchPointOffset = touchPointStart - new Vector2(Input.GetTouch(i).position.x, Input.GetTouch(i).position.y);
                     break;
                     case TouchPhase.Ended:
                     case TouchPhase.Canceled:
                     flyFingerId = -1;
                     touchPointStart = Vector2.zero;
                     break;
                 }
             }
         }
 
         Debugui.text = "touches: " + Input.touches.Length.ToString() + " / flyfingerID:" + flyFingerId.ToString();
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

128 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why is my first touch interpreted as a mouse click? 0 Answers

How can convert keyboard controller to touchscreen(android .ios ...etc) 1 Answer

Rotate Player w/Touch Input Controls 0 Answers

Problem with Swipe and rb.MovePosition 0 Answers

How can I change my player control method to use a touch screen ?? Pong-clone 2D 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges