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 joblat93 · Jan 04, 2017 at 09:57 AM · collision detectioncollision2dcollision issues

collision 2D not working on android device

hello everyone i'm working on a 2D android shooting game with unity 5.4 now to display some buttons that means that the game is over, i used OnCollisionEnter2D to detect if the bullet collides with a gameobject and then set the button canvas to active and timescale to 0 to stope the game

here is the code i used :

 void OnCollisionEnter2D(Collision2D col) {
                 if (col.gameObject.tag == "poop"){
                         Destroy (col.gameObject);
                         Time.timeScale = 0;
 
 
                         foreach ( Canvas button in buttons )
                         {
                                 button.gameObject.SetActive (true);
                         }
                 }
         }

the probleme is that this works fine in the emulator but when i build the apk and install in my android device, it does not work

any help, please ???!!!`enter code here`

Comment
Add comment · Show 11
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 tanoshimi · Jan 04, 2017 at 10:20 AM 0
Share

"does not work" is not a helpful problem description. What did you expect to happen? What actually happened?

avatar image joblat93 · Jan 04, 2017 at 12:09 PM 0
Share

the idea is when the 2 object collide this will set some buttons to active, in fact is the game over lenu when they collide the game stops and the menu take place

so in unity emulator, it works but in device it does not, i see it colliding but the menu does not appear

thank you

avatar image tanoshimi joblat93 · Jan 04, 2017 at 12:50 PM 0
Share

The menu does not appear..... but the colliding gameobject gets destroyed and the timescale gets set to 0, right? So where do you assign the buttons array? Why do you set timescale to 0 anyway? There are a ton of problems I see with people trying to use that, since it stops the game update loop from running.

avatar image joblat93 · Jan 04, 2017 at 01:35 PM 0
Share

no the gameobject does not get destroyed and the time scale dont doesnt change but in the device i see the gameobject collide with the other game object because i see the gameobject stops moving

i forgot to mention this

i added : " public Canvas[] buttons; "

avatar image hdtnl joblat93 · Jan 04, 2017 at 01:57 PM 0
Share

did you check the player's tag?

avatar image joblat93 hdtnl · Jan 04, 2017 at 05:31 PM 0
Share

yes there is no probleme there thank you

avatar image RobAnthem joblat93 · Jan 04, 2017 at 05:12 PM 0
Share

I think you need to re-assess what you are doing when you have a Canvas Array.

avatar image joblat93 RobAnthem · Jan 04, 2017 at 05:29 PM 0
Share

what do you mean by re-assess, i'm sorry i'm new to coding thank you

Show more comments
avatar image juli303 · Jan 04, 2017 at 05:01 PM 0
Share

Does the collision work on other Platforms?

avatar image joblat93 juli303 · Jan 04, 2017 at 05:30 PM 0
Share

i'm only doing this for android it's working in unity emulator but not in device thank you

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

7 People are following this question.

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

Related Questions

Unable to get Player to stay on Moving Platform, Collision not being detected. 0 Answers

Bullets go through collider even with continuous collision detection! 0 Answers

Unity2D: How to make my player not walk through walls? 1 Answer

collisions does not get detected every time 0 Answers

Ensure a bullet only hits one enemy 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