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 gronkey · Jun 26, 2018 at 02:54 AM · androidtriggerbugphysics2dcollision detection

Why are my OnTriggerEnter2D events firing only on android in a situation they shouldnt be firing?

Related Reddit thread

Related Stackoverflow thread

I have been struggling with a collision bug that only happens when I install the game on an android device.

I have a very simple game set up like air hockey. Some objects to represent paddles, a puck, a couple of end zones for scoring, and walls. Whenever I move one of the paddles and collide it against the puck at a very low velocity, my ontriggerenter2d events are firing on my end zones even though the puck is nowhere near the end zones.

Here is my OnTriggerEnter2d function in my end zone controller script:


 // EndZone
 void OnTriggerEnter2D(Collider2D Other)
 {
 
 Debug.Log("EndZone::OnTriggerEnter2D " + playerNumber.ToString());
     if (Other.gameObject.tag == "Puck")
     {
         Observer.SendMessage("Score", "" + playerNumber.ToString());
     }
 }
 



I'm not sure what other information could be relevant. I will provide anything asked for including my entire project if deemed necessary.

This bug only happens when I actually build to android, not when I run the game on desktop. Even if I'm using a tablet and unity remote to provide input.

Comment
Add comment · Show 7
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 NoDumbQuestion · Jun 26, 2018 at 04:50 AM 0
Share
 Debug.Log(Other.GetInstanceID());

These type of collision normally related to unexpected collider. Check if it was Puck that hit Collider. $$anonymous$$ight be double collision(rigidbody + 2D Collision)

avatar image gronkey NoDumbQuestion · Jun 26, 2018 at 05:20 AM 0
Share

Hi. I've done that. In fact I've used android studio debugging to find that it is in fact both end zone triggers popping. Even if it were another collider, it shouldn't be sending the message since I check the tag of the gameobject so it shouldn't be a problem. It is the puck.

Here's something new I found out which I posted in the stackoverflow thread: when my paddle collides with my puck, I apply a force to the puck with AddForce. If I comment that line out, the bug doesn't happen. $$anonymous$$y triggers never go off.

avatar image NoDumbQuestion gronkey · Jun 26, 2018 at 05:24 AM 0
Share

Sound like kinematic fault in rigidbody if you have one. (mistakenly use add force in Update(), anything addforce to rigidbody should be in FixedUpdate())

Like if you seperate rigidbody + collider and render texture.

$$anonymous$$ight be texture and rigidbody is in different place when hit by paddle.

Show more comments

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

218 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 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

OnTriggerEnter called one step too late 0 Answers

physic 2d bug with mass n triggers!? 1 Answer

Only particle shaders are visible after building for Android 0 Answers

What is the best way to find the item underneath the player? 1 Answer

2D collision not registering 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