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 /
  • Help Room /
avatar image
0
Question by Marshal_Alessi · Nov 29, 2015 at 08:58 PM · c#unity 5scripting problemcollisionscriptingbasics

Collision Detection Not Working (Unity 5.2.3)

Hello!

I have been making a game, and I'm at the point of which I'm adding in Enemy AI who swing and attack the player. Unfortunately, I can't get the detection to work. Collision is pretty rudimentary, but for whatever reason, it's not clicking. I have been reading several articles online, trying to understand why it's not working, but nothing I have read has bore a viable solution.

For the record, both the enemy AI and player have Mesh Colliders, neither of them have the "Trigger" option or the convex option selected. Both have Rigidbodies. I put a debug.log bit in my code to see if it would detect anything, and it does not...If I'm missing something, please let me know.

 using UnityEngine;
 using System.Collections;
 
 public class EnemyManager : MonoBehaviour {
 
     void OnColliderEnter(Collision coll) {
         Debug.Log ("Object Detected");
         if (coll.gameObject.tag == "Player") {
             Debug.Log ("Hit Player");
         }
     }
 }
 
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

5 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by holymio · Nov 30, 2015 at 06:46 PM

I had the same problem. I downgraded to version 5.2.2 and everything was working fine. I assume this is a bug in the 5.2.3 version.

Comment
Add comment · Show 1 · 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 Marshal_Alessi · Dec 03, 2015 at 07:12 AM 0
Share

Tried it, and it works. That's frustrating, but I'm glad I know it wasn't me now.

avatar image
0

Answer by Mrslayer01 · Nov 29, 2015 at 10:23 PM

I'm not quite sure why that is not working but what you could always do is put a boxcollider around them and just make it a trigger and see if it works that way.

Comment
Add comment · 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
0

Answer by Marshal_Alessi · Nov 29, 2015 at 10:36 PM

I could do that for test purposes, but that wouldn't work in game, as I don't want it to be a constant damage, only when they are swinging. I'll try it for test sakes.

Also, I noticed I had typed in OnColliderEnter, I have changed it to the correct OnCollisionEnter.

Comment
Add comment · 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
0

Answer by liam1135 · Dec 03, 2015 at 01:06 PM

Same issue here. 5.2.3 broke all collision in our game.

Comment
Add comment · 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
0

Answer by saybor · Feb 21, 2016 at 07:31 PM

Same issue here. All collision broken on Android from 5.2.3 till 5.3.2 On PC and Editor working normal

Downgrade to 5.1 or 5.2 solving this issue.

Comment
Add comment · 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

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

50 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

Related Questions

OnCollisonEnter2D Not Firing after checking collider 1 Answer

Can not get my raycast to detect an object 0 Answers

Mathf.Lerp Time problems. 1 Answer

Does this Truncate formula seem efficient? 2 Answers

Performance peaks in ScriptRunBehaviourUpdate 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