OnTriggerExit not working reliably

Can anyone spot why this script might not be working? I have a Sphere collider on a gameobject that has this script attached, and it is colliding with a mesh collider on a gameobject that has a non-kinematic rigidbody, as mentioned in the documentation. OnTriggerEnter seems to work all the time, whereas OnTriggerExit might work once or twice, then cease functioning. I’ve looked at using OnCollisionEnter/Exit instead, but that seems to not work with colliders as triggers.

var base : Component;
var touching : int = 0;


function Start(){
	base = transform.parent.GetComponent("baseEdit");
}

function OnTriggerEnter(other : Collider){
	if(other.name=="terrain line"){
		touching = 1;
		Debug.Log(other.name);
	    	if(transform.name=="leftAnchor"){
				base.leftTouching = 1;
			}
			else{
				base.rightTouching = 1;
			}
	}
}

function OnTriggetExit(other : Collider){
	if(other.name=="terrain line"){
		touching = 0;
		Debug.Log(other.name);
			if(transform.name=="leftAnchor"){
				base.leftTouching = 0;	
			}
			else{
				base.rightTouching = 0;
			}
	}
}

OnTriggerExit really doesn’t work in this script, and the reason is a typo: you’ve wrote OnTrigge[t]Exit instead of OnTrigge[r]Exit! But don’t feel ashamed: I looked for errors in the code dozens of times (like I guess you did too) and found no errors! I only found the son of a bitch when I decided to write a second OnTriggerExit function - and to my big surprise it worked fine, and Unity didn’t complain about your OnTriggetExit…

Wow, silly mistake. I’ve rewritten that script a dozen times, trying to make things work, switching to OnCollisionExit, etc…I will see if it works now. Meanwhile, I found another way to get the info I wanted- I’m comparing the position.y of an ‘anchor point’ (empty game object placed as child on another object) to the nearest position.y on a spline which is terrain (RageSpline…awesome add-on by the way). I’m rotating a ‘base’ on terrain to match the normal of the collision point with the spline (terrain)…and I have anchors on left and right to determine if they are above/below the terrain, which would mean the base doesn’t fit the curvature of the terrain at that position (a level editor of sorts). So I’m wondering if it’s cheaper to do that comparison of positions, or if colliders on the anchors (the original idea) is cheaper…any comments?