OnTriggerStay not updating every frame?

Hey guys,

I’ve got some characters split into triggers on the left and right sides of the screen, and they’re set to jump when their corresponding side’s jump button is pressed. It works on average 9/10 times, but can go on longer streaks of working correctly. I can’t figure out why it would occasionally fail, albeit rarely. Any ideas? Thanks in advance.

void OnTriggerStay (Collider other)
	
{
		
	if (other.tag == "JumpZoneB") {
		if (Input.GetButtonDown ("JumpB")) {
			
			if (status == PlayerMoveStatus.Jump) { 
				DOUBLEJUMP ();
			}
			
			
			if (status == PlayerMoveStatus.Run) { 
				
				
				JUMP ();
			}
		}
	}
	
	if (other.tag == "JumpZoneA") {

		if (Input.GetButtonDown ("JumpA")) {
			
			
			if (status == PlayerMoveStatus.Jump) {  
				DOUBLEJUMP ();
			}
			
			
			if (status == PlayerMoveStatus.Run) { 
				
				
				JUMP ();
			}
		}
	}
	
}

OnTriggerStay will not call on every frame. One way to get around this is to have OnTriggerEnter, and OnTriggerExit set a bool. Then execute your code in the FixedUpdate().

So something like:

private bool trig;
void OnTriggerEnter() {
    trig = true;
}
void OnTriggerExit() {
    trig = false;
}
void FixedUpdate(){
    if(trig){
      //some code here.
     }
 }