I have a "first person controller" object with a "weaponsmanagemnt" script and a child object: "Graphics."
graphics has a capsule collider on it.
another object in the world has a "triggerme" script on it which I want to reference weaponsmanagement when I walk onto it. I'm using this code but its giving me a NullReferenceException error on the line after the if statement:
function OnTriggerEnter (other : Collider)
{
if (other.gameObject.tag == "Player"){
other.gameObject.GetComponent("WeaponsManagement").showGui();
}
}
the weird thing is, even though it gives me that error: "object reference not set to an instance of an object" it still seems to call the function showGui.
also, I've tried other things such as "other.gameObject.transform.parent.GetComponent" and the like. I get the same error. How do I call the script on it's parents GameObject if all I have is a collider to work with?