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
1
Question by piyu · Sep 15, 2016 at 01:34 PM · c#androidunity 5samsung

Unity Touch sensitivity issue on Samsung Devices

We are working on a touch based app for Android in Unity3D and C# which colors part of an image with Flood Fill as per touch.

Problem is, while on most of the devices the touch works smoothly, on Samsung Note 5 and S6 specially, it takes a few taps to register a single touch. To extend the confusion, when we try other similar apps on these devices, they have no problems at all.

Here's the code we used for the touch. It's basically a simple raycast on tapping the screen. We tried with both, mousePosition as well as GetTouch.

 if (Physics.Raycast (Camera.main.ScreenPointToRay (Input.GetTouch(0).position), out hit, Mathf.Infinity)) {
 
         Renderer rend = hit.transform.GetComponent<Renderer> ();
         MeshCollider meshcol = hit.collider as MeshCollider;
 
 
         myImage = Instantiate (rend.material.GetTexture ("_MainTex")) as Texture2D;
         Vector3 texCoord = hit.textureCoord;
         float scaleX = rend.material.GetTextureScale ("_MainTex").x;
         float scaleY = rend.material.GetTextureScale ("_MainTex").y;
         float deg = rend.material.GetFloat ("_RotationDegrees");
         deg *= Mathf.Rad2Deg;
         texCoord.x = (((texCoord.x * scaleX + rend.material.GetTextureOffset ("_MainTex").x)));
         texCoord.y = (((texCoord.y * scaleY + rend.material.GetTextureOffset ("_MainTex").y)));
         #region ROTATION
         float s = Mathf.Sin ((deg * Mathf.PI) / 180);
         float c = Mathf.Cos ((deg * Mathf.PI) / 180);
         Vector2 temp = new Vector2 (texCoord.x, texCoord.y);
         temp.x -= 0.5f;
         temp.y -= 0.5f;
         float xnew = temp.x * c + temp.y * s;
         float ynew = -temp.x * s + temp.y * c;
         temp.x = xnew + 0.5f;
         temp.y = ynew + 0.5f;
         texCoord.x = temp.x;
         texCoord.y = temp.y;
         #endregion
         texCoord.x *= myImage.width;
         texCoord.y *= myImage.height;
 
 
         FloodFiller.RevisedQueueFloodFill (myImage, (int)texCoord.x, (int)texCoord.y, GameplayConstants.currentColor, false);
         //  penSprite.GetComponent<Animation> ().Play ();
         rend.material.mainTexture = myImage;
     }

We have even used a script that detects DPI and makes changes to the Unity UI sensitivity on the fly, but that too doesn't help. In fact our other devices have similar DPI levels.

Will be thankful for any help!

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Gnejs · Sep 16, 2016 at 11:33 AM

Hi, I do not have an answer but a (maybe) similar problem. Got some reports regarding problems tapping/touching some elements in the UI and after investigating it turned out that some elements could only be touched on the upper part of the element. e.g the top 40% of the image for example. For most devices it was working as intended but on e.g. S6, S7 and Note 8.0 the problem was present.

Maybe it is not the same problem though?

Comment
Add comment · Show 2 · Share
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 piyu · Sep 16, 2016 at 12:36 PM 0
Share

Hi, It seems like a similar problem. In our case some parts of the image are tapable only after a few tries. In Some other apps like colorfy it works perfectly fine in same devices.

Were you able to come to a solution at all?

avatar image Gnejs piyu · Sep 16, 2016 at 01:17 PM 0
Share

For me the issue was that none-visible elements, for example Text$$anonymous$$eshPro text objects occupying the same area blocked it even though they were suppose to be behind and not target of raycasts. The problem was still only visible on mostly Samsung devices which made it a lot stranger. I made moved/resized/disabled any interfering elements. Not sure if it is related to your problem except that it seems to affects the same device families. :S

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

how to describe a android path in c# script 1 Answer

Error while trying to build and run gear vr project 1 Answer

Unity Android fetching wrong screen resolution 1 Answer

How can I rotate my player with a Joystick? 0 Answers

Google Daydream Thread with Unity 1 Answer


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