[fixed] OnTriggerExit never called if I change Character Controller center in-script...


I have a setup in 2d where I need to know when my player (which has a character controller, and attached movement script) ENTERS and EXITS an invisible trigger box. I put a script on the box with an OnTriggerEnter() and OnTriggerExit(), and it works fine, until I started changing the Character Controller center inside the movement script: now, OnTriggerEnter() is getting called every few frames, while OnTriggerExit() is never called… I’m constantly changing the center based on if the player is crouching or not. The specific section of the code giving trouble looks like this:

void Update(){
          controller.center = new Vector3 (0, 0, 1.78f);     //this is the problem
          controller.height = 4.36f;
     } else{
          controller.center = Vector3.zero;     //this is the problem
          controller.height = 6.92f;
     //movement and other things


I could try to find a workaround, but if someone could give some insight into fixing this problem, I would greatly appreciate it!

I updated it to only change the charactercontroller center once using an if statment, all problems went away!

I meet the same problem. I verify that change CharacterController’s center is indeed the reason that trigger’s OnTriggerExit is not called.
It is probably a Unity bug. I am using Unity 4.6.6p4, the bug still exists!