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 /
avatar image
0
Question by rubenworks · May 14, 2016 at 09:41 AM · iostouch

Touch recognition problems with IPhone 6s.

The following code is supposed to oben a UI element when a object in the scene is touched. Pretty straightforward isnt it. Nevertheless by testing it on different IOS devices i discovered strange problems. So this code works as expected on iPhone4s, iPhone5s, IPad3, IPad Air2, IPhone6 but NOT on the Iphone6s! The touch recognition in completely of. Sometimes It reacts on very 'slight' touches (like barely touching the display at all) Most of the time it ignores the 'block-raycast-through-ui-elements' funcion as well. So it's kinda weird all over the place. Does someone have any experience with that problem? I'm very desperate by now.

 void Update()
     {
         
             if (Input.touchCount == 1 && gameIsReady == true)
             {
                 touch = Input.GetTouch(0);
                 Vector3 p = cam.ScreenToWorldPoint(new Vector3(touch.position.x, touch.position.y, 0.0f));
 
                 if (touch.phase == TouchPhase.Began)
                 {
                     if (EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId))
                     {
                         fingerOverUI = true;
                     }
                     else
                     {
                         fingerOverUI = false;
                     }
 
                     moved = false;
                 }
 
                 if (touch.phase == TouchPhase.Moved)
                 {
                     moved = true;
                     StopAllCoroutines();
                     FloatingUI.SetActive(false);
                     panelIsOpen = false;
                 }
 
                 if (touch.phase == TouchPhase.Ended && moved == false && fingerOverUI == false)
                 {
                     hit = Physics2D.Raycast(new Vector2(p.x, p.y), Vector2.zero);
 
                     if (hit.transform.tag == "Country" && panelIsOpen == false)
                     {
                         clickedCounty = hit.transform.name;
                         FloatingUI.SetActive(true);
                         panelIsOpen = true;
                         StartCoroutine(moveCamToCountry(hit.transform.name));
                         StartCoroutine(displayFloatingStats(hit.transform.name));  //Open the UI I element. 
                         moved = false;
                     }
                     else if (panelIsOpen == true)
                     {
                         FloatingUI.SetActive(false);
                         panelIsOpen = false;
                         StopAllCoroutines();
                     }
                 }
             }
             else if (Input.touchCount > 1 && gameIsReady == true)
             {
                 StopAllCoroutines();
             }
 }
 
 
Comment
Add comment · Show 1
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 rubenworks · May 14, 2016 at 03:35 PM 0
Share

addendum: I currently work with Unity 5.3.0f4

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Delta touch trembling 0 Answers

How can I get the exact iphone screen touch position? 2 Answers

Simultaneous Touch Drag Controls 0 Answers

Multi touch not working on iOS (does work on Android) 1 Answer

Scripting a "touch" on an object in iOS. 3 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