I have this script attached to my bullet, which is currently just cube in 2d space. it has rigidbody2d, boxcollider and istrigger is checked.
using UnityEngine; using System.Collections;
public class EnemyBulletCollision : MonoBehaviour {
void OnTriggerEnter(Collision coll)
{
if(coll.gameObject.tag == "Enemy") {
Destroy(coll.gameObject);
Destroy(gameObject);
}
}
}
Enemy is also cube with BoxCollider, Rigidbody2d and istrigger checked. Nothing just happens. i tried all kind of things, but none works. Kind of stuck here.