Game object hit take to much life

Hi
So … I’m making a game where, if you hit the cactus it takes you life, but instead taking you like 10 hp when you touch the object … it killes you.
The code is :

function OnControllerColliderHit(hit : Collider){
if(hit.gameObject.tag == "cactus"){
HealthManager.health -= 10;
}

you shouldnt use OnControllerColliderHit for this.
use instead OnTriggerEnter(hit:Collider)
and put the cactus on “isTrigger” state in the collider options.
i think the OnControllerColliderHit is called each frame you collide with the object while performing a move so its not what you need and that is why you lose too much health (-10 health per frame when you collide with cactus).
OnTriggerEnter will happen 1 frame.
also you can do a “ghost mode” so when ever ghostMode = true, you cant get hit. and when getting hit do:
ghostMode = true;
yield WaitForSeconds(3);
ghostMode = false;

Ok that works fine, thank you very much.

I want to see this game :stuck_out_tongue:

sounds funny a cactus taking your life xD