Null Reference Exception when trying to active script

Hello,

When my marble collide with the gravity pickup, then the marble should activate the activation script on the gravity pickup.
I am using the following code on my marble:

function OnTriggerEnter (other : Collider)
{
	if (other.tag == "gravity")
	{
		other.GetComponent("Gravity_defier").Activate();
	}

}

And the gravity object uses the following code:

function Activate()
{
	Physics.gravity = Vector3(0, -gravityAmmount, 0);
}

However, when my marble is triggers the object, I get Null Reference Exception: Object reference not set to an instance of an object. The marble has a rigidbody, and a spere collider, and the gravity pickup has a capsule collider set to trigger.

How should I fix that?

So your gravity pickup has a capsule collider set to trigger- are we to assume you have a script/monobehaviour called “Gravity_defier” attached to it as well? If not, that would certainly cause the error you’re having.

If you DO have a script/behaviour called Gravity_defier, I might recommend you use a more standardized naming convention for your classes (but that’s beside the point).