Boolean detection on collision.

I’m not sure what I’m doing wrong but I have a simple script which sets boolean true or false depending on whether the collider is entered or not. I’m trying to make it bring up a debug log before I add the sound effect and counter for walking.

The collider is set to “Is Trigger”, so I’m not sure if there is something else.

#pragma strict

var GrassBool : boolean = false;

function OnTriggerEnter (Grass : Collider)
{
	if(Grass.gameObject.tag=="Player")
	{
		GrassBool = true; 
	}
}

function OnTriggerExit (Grass : Collider)
{
	if(Grass.gameObject.tag=="Player")
	{
		GrassBool = false; 
	}
}

function Update ()
{
	if(Input.GetKey(KeyCode.W) && GrassBool == true)
	{
		Debug.LogWarning("You are on grass");
	}
}

Hello,
This gave me quite the headache.
You need to have a rigidbody attached to one of the objects.