Can someone tell me what I did wrong with the collision? (C#)

Can someone tell me what I did wrong? When I opened unity I added this script to my player and also tagged a cube as zombie. I even enlarged the cube’s collider. But when my player collides with the cube, health is not taken away from the player’s current health.

using UnityEngine;
using System.Collections;

public class SinglePlayerProfile : MonoBehaviour {

public int ZombieDamage = 20;
public int RageZombieDamage = 25;
public int CrawlerZombieDamage = 10;
public int CurrentHealth;

// Use this for initialization
void Start () {
	
	CurrentHealth = 100;
	
}

// If a Zombie touches the player
void  OnCollisionEnter ( Collision collision  ){
	
	if(collision.gameObject.tag == "Zombie") //If it is a normal zombie
		{
			CurrentHealth = CurrentHealth - ZombieDamage;
		}
	
	else if(collision.gameObject.tag == "Rage_Zombie") //If it is a rage zombie
		{
			CurrentHealth = CurrentHealth - RageZombieDamage;
		}
	
	else if(collision.gameObject.tag == "Crawler_Zombie") //If it is a crawler zombie
		{
			CurrentHealth = CurrentHealth - CrawlerZombieDamage;
		}		
	
	else //If player is not hit by any zombie, then do nothing
		{
			CurrentHealth = CurrentHealth; //Not needed, but I placed here just to make sure it does it
		}
	
}

// Update is called once per frame
void Update () {
	
	

}


void OnGUI () {
	
	
	
}

}

Hi the problem lies here

void OnCollisionEnter ( Collision collision ){
 
if(collision.gameObject.tag == "Zombie") //HERE YOU Cannot check for sollidion by using only collision.gameObject
{
CurrentHealth = CurrentHealth - ZombieDamage;
}
..............etc

}

Herr You Cannot check for sollidion by using only collision.gameObject

So simple change it to

if(collision.collider.gameObject.tag == "Zombie") //HERE YOU Cannot check for sollidion by using only collision.gameObject
{
CurrentHealth = CurrentHealth - ZombieDamage;
}

Get familiar with the debugger. In Mono, go to the Run menu, Attach to process, choose Unity editor. Then set a break point at the first line of you OnCollisionEnter routine to see if it stops there. And/or put ‘print ("collided with "+collision.gameObject.tag);’ there and watch the console as you collide with the cube.

Can i tell you something? its prefered to add the collision check into the zombie itself and not in the “player” this way every Zombie can damage the “player” individually and works better, the way you have it the “player” script will get much and much bigger the more different enemies you add. its prefered to manage the collision in the “enemy” and not in the “player” and make some function into the “player” script that damage the “player” something like this:
//Zombie script
//all your previously variables here and stuff.

    void OnCollisionEnter(Collision player)
    {
      if(player.collider.gameObject.tag == "Player")
      {
        //Here you can divide the damage depending on zombie stage
        if(tag == "Zombie")
        {          player.collider.gameObject.GetComponent<PlayerScrip>().DamagePlayer(zombieDamage);
        }
        if(tag == "Rage_zombie")
        {          player.collider.gameObject.GetComponent<PlayerScrip>().DamagePlayer(rageZombieDamage);       
        }
      //Here you can put all the other damage categories and values...
      }
    }

in the other hand you should create and add a new scritp to the player or whatever object that should recieve damage, like this:

sing UnityEngine;
using System.Collections;

public class PlayerScript: MonoBehaviour {
 
 int currentHealth;

 void Start()
 {
  currentHealth = 100;
 }

 void Update()
 {
 }
  
 public void DamagePlayer(int damage)
 {
   currentHealth -= damage;
 }

}

this is much more simple, because this way the player can recieve damage from so many other enemies without adding more lines tho the player script, just attack the zombie script to your zombies and the player script to your player.