Very simple question that is solved by myself so if anyone want to use this code, feel free.
var life = 0;
function OnCollisionEnter(boom : Collision) {
if(boom.gameObject.tag == "bullet")
{
life +=1;
if(life == 50)
Destroy(gameObject);
}
}
Make your weapon that hits the enemy have a tag “Bullet”. And then attach this script to your Enemy. You can change the Life == 50
to 25 to kill enemy faster or the Life +=1
to 5
THIS IS AN ANSWER
C#
- Felipe