- Home /
Question by
Keki9080 · Feb 04, 2018 at 06:11 AM ·
2drigidbody2dcollider2d
My character won't collide with walls 2d
I'm a begginer in unity but My character is not colliding with anything but the enemy bullets, Here is what is happening
The red line is pointing at the player This is what my Character collision code looks like (If it has a problem)
void OnCollisionEnter2D(Collision2D col){
if (col.gameObject.tag == "Enemy" && DamageCoolDown < Time.time){
Damaged();
DamageCoolDown = Time.time + 0.4f;
Destroy(col.gameObject);
}
if (col.gameObject.tag == "Boss" && DamageCoolDown < Time.time){
Damaged();
DamageCoolDown = Time.time + 0.4f;
}
}
And this is what my character's components look like.
What should I do?
player.png
(1.2 kB)
components.png
(21.9 kB)
Comment