Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

Collision Detection Issue with SetActive(false) not working

$
0
0
When I throw something at an enemy, it doesn't detect collision. I have a Rigidbody and Capsule collider on the player (Correctly placed on the player). For Enemy I have the same, a Rigidbody and Capsule Collider on the Enemy (Correctly placed on the enemy). I have a Enemy Script on the enemy, but it seems like the collision hits the enemy, but the enemy is never destroyed. I need it to disappear after it is destroyed, but it isn't working right: public class Enemy : MonoBehaviour { public int health = 1; public virtual void Hit() { health--; if (health <= 0) { Destroy(gameObject); } }

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>