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 Ahmed_Alhadi · Sep 27, 2016 at 10:20 AM · android buildcollider2dtriggersscene load

Issue with colliders on Android

I have a simple game of a kite flying through simple square colliders. When tested in the editor everything is fine. But when it is built for Android the colliders won't work after reloading the scene several times. So the BoxCollider2D is working for the first round but after reloading the scene couple times it won't work. I tested it on (Samsung Galaxy S5 & LG G3) and I noticed that this behavior occurs after the game have dropped the frame rate.

I don't know if this worth mentioning: I tried to have the player as a prefab (as a solution) and re instantiate it in the loading of the game as follows:

     void Awake () {
     
         Vector3 pos = new Vector3 (-2.79f,-1.7f,0f);
 
         Instantiate (player, pos, transform.rotation);
     }

but nothing changed.

the trigger is as follows:

     ![void OnTriggerEnter2D (Collider2D other) {
     
 
         if (other.tag == "Kite") {
         
             Instantiate (explosion, kiteParent.transform.position, kiteParent.transform.rotation);
             kiteParent.SetActive(false);
             gameController.GameOver();
 
             Invoke("KillExplosion",2.0f);
 ]
 
         }
     }][1]

This is the code for restarting the level.

     public void Restart()
     {
         gameOver = false;
         restartBtn.gameObject.SetActive (false);
         pauseBtn.gameObject.SetActive (false);
         SceneManager.UnloadScene(SceneManager.GetActiveScene().buildIndex);
         SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
     }

and the collider on the hazard as in the printscreen below:

[1]: /storage/temp/78888-capture.png

[Update - Issue Resolved] Ok, I found the reason causing this issue. Make sure to assign the instantiated object to a GameObject variable as the compiler can't destroy the instantiated assets which causes the game object's collider not to work properly.

capture.png (23.3 kB)
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
5

Answer by chemariz · Nov 14, 2018 at 09:24 AM

I had the same problem. In my case was because I removed some tag from the list. In the editor you dont need to restart unity, but for Android, if you dont do it, the old tag is still there messing everything up.

Just restart unity and make sure the old tag is completely gone.

Comment
Add comment · Show 3 · 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 Asisvenia · Dec 22, 2018 at 08:26 PM 0
Share

@chemariz, Thank you very much! I solved my problem thanks to you..

avatar image michaelb212 · Mar 18, 2019 at 11:03 PM 0
Share

You just saved my hours of debugging !

avatar image Baschti-aus-s · Jan 21, 2020 at 06:00 PM 0
Share

Lifesaver. $$anonymous$$ost confusing thing i found unitl now in 4 years of working with Unity. Thank you!

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

6 People are following this question.

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

Related Questions

Comparing the value of a peg to its neighboring pegs' values 0 Answers

Trigger Triggers Without Collision 1 Answer

Multiple Hitbox child Objects (King of Fighters) 0 Answers

Issue with scene changing in Android Build. Buttons register touches but the functions called dont work. 2 Answers

OnTrigger events not working 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