Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
0
Question by hynra · Feb 28, 2014 at 11:51 AM · unity 2dtouchscreen

disable multi touch on specific screen area

I'm currently developing unity 2d platformer game for android. Then, i'm implement touch control with screen position detection.

alt text

as you see, i split the screen to 3 pieces : 1 for move to left, 2 for move to right, and 3 for jump. here the lines :

     void Start () 
         {
             anim = gameObject.GetComponent<Animator>();
             w = Screen.width;
             h = Screen.height;
         }
     
     void Update ()
         {
             if (Input.touchCount > 0) {
                 while (k < Input.touchCount) {    
                     if (Input.GetTouch (k).position.y > h / 3 && Input.GetTouch (k).position.x < w / 2 ) {                                                
                         // Move your character right
                         moveToRight();
                         }
                     if (Input.GetTouch (k).position.y > h / 3 && Input.GetTouch (k).position.x > w / 2 ) { 
                         // Move your character left
                         moveToLeft();    
                         }
                     if (Input.GetTouch (k).position.y < h / 3 && anim.GetBool ("Grounded")) {    
                         // jumping
                         jumpPlayer();
                         }
                 ++k;
             }
         }

The script jus fine, work normally. But for any reason i want to disable multi touch finger on area 3, i have seen unity docs for disable multi touch : Input.multiTouchEnabled = false; , then i asign that bool to Jumping touch control (area 3) :

 if (Input.GetTouch (k).position.y < h / 3 && anim.GetBool ("Grounded")) {    
                         // jumping
                  Input.multiTouchEnabled = false;
                         jumpPlayer();
                     }


for any reason too, i assign Input.multiTouchEnabled = true on touch area 1 and 2. But not that i want. Every i touch area 3, multi touch is disable, but when i touch area 1 or 2, on area 3 it's still enable to multi touch. I Know the problem, because i set Input.multiTouchEnabled = true on touching area 1 and 2. but, it's not possible to set false multi touch on touching area 1 and 2. And finally, i have conclusion to disable multiTouch on screen area 3 (not with touch, but permanently). question is : How to disable multi touch on specific screen area ?, in this case on area number 3. any answers would be very helpful. Thanks.

Comment
Add comment · Show 5
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
avatar image hynra · Mar 07, 2014 at 05:52 AM 0
Share

Any suggestion ?

avatar image nazia08 · Mar 07, 2014 at 07:15 AM 0
Share

I think the multi touch2 of that android is low in quality so thats why i prefer touch3 which is much useful for me .

avatar image hynra · Mar 07, 2014 at 08:18 AM 0
Share

Is that version or something ? $$anonymous$$ulti touch 3 ?

avatar image OSG · Mar 07, 2014 at 08:36 AM 0
Share

For what do you need such complicated behaviour? I think there are beter way to do what you need. Am I right and you need to avoid calling moveToLeft() and moveToRight() functions when player hits Jump?

avatar image hynra · Mar 11, 2014 at 03:19 PM 0
Share

Because every i'm hit the jump screen with double fingers or more, it's calculate jump power with amount of fingers.

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

22 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

Related Questions

How to make Mobile Touch Controls work when pressing the left and right side of the screen 1 Answer

Make an obect take priority over another when touched? 0 Answers

How to convert mouse input to mobile touch in unity 1 Answer

How click and drag a 2D game object without click and dragging the Camera Orthographic? 1 Answer

Images are invisbles in Scene but visibles in Game preview 2 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