In Unity 5, I have a player shooting a projectile in aim to hit a boss, and inflict damage upon contact with the projectile. Though for some reason, the projectile and boss aren't colliding with each other.
I've done the following;
- Made sure that both the projectile and boss have a BoxCollider 2D and Rigidbody 2D
- Made sure that they're on the same Z-Index and on the same layer
- Tried to Debug.Log() if there's any collision (there isn't)
- Made sure I'm using OnCollisionEnter2D on the boss' health script
- Compared the syntax I use with another collision (where the player collides with an object and dies - this works perfectly fine).
However, none of these seem to be working.
This is the boss' health script:
void OnCollisionEnter2D (Collision2D coll)
{
Debug.Log("COLLIDED");
bosshealth -= 1;
}
Here is the projectile prefab:
And the boss prefab:
Does anyone have a clue as to why they're not colliding? the projectile just glides over the boss