Not detecting Collision
I made a post like this yesterday about my gameobject not detecting collisions and I fixed it. Now I have that problem again and I really have no idea what's wrong.
This is the script I'm using on the gameobject that will detect the collision:
void OnTriggerEnter2D(Collider2D other)
{
Debug.Log("Hit Player");
player.GetComponent<PlayerController>().Death();
}
The gameobject attached with that script has been set to a trigger, plus both objects, the gameobject with the script and the player have rigidbodies and colliders but It still won't detect the collision and I have no idea why. The colliders are big enough to detect the gameobjects.
Have I missed something out again?
Answer by Zoogyburger · Mar 11, 2016 at 03:51 AM
Is this not doing anything or is there an error occurring? Try setting both of the object's colliders to be Istrigger.
It's just not doing anything. No error. Setting them both to a trigger does nothing.
I tried your script and it worked for me. You might be having a weird bug.