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?