Problem with a script collision!! Please help!!

Hello, I’m new in both the forum and in unity with programming, and I started to create a simple video game, but I have a problem:

I want to lose health when the player collides with a cube … I tried in all ways, looking on the internet and learning more about the collision, but no, the script does not work … excuse my excessive stupidity, but unfortunately as I said before new … can you help? this is a part of the script that I “tried” to do:

using UnityEngine;
using System.Collections;

public class Dead : MonoBehaviour {
public int Health = 100;

void OnCollisionEnter(Collision collision) {
	if (rigidbody.collider.gameObject.name == "Cube") {
		Health -= 10;
	}
	}

any ideas?

Try this

void OnCollisionEnter(Collision collision) {
    Debug.Log( (collision.gameObject.name);
    if (collision.gameObject.name == "Cube") {
       Health -= 10;
    }
  }

Nothing … I tried both scripts but none seem to work …

the rigidbodies are all set:

mass 1
drag 0
Angular Drag 0:05
Use Gravity no
Kinematic no (yes only for the player, because if I mailed it to no player was not moving)
interpolated None
Continuous Collision Detection

and Freeze Position all to 0

But perhaps have the Collider is the “Box Collider” in the cube and the “Sphere Collider” in the sphere? because if so are all set:

Is not Trigger and no materials.

Thanks anyway for availability :wink: