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");
}
}
}
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.
Tried it, and it works. That's frustrating, but I'm glad I know it wasn't me now.
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.
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.
Answer by liam1135 · Dec 03, 2015 at 01:06 PM
Same issue here. 5.2.3 broke all collision in our game.
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.