Diffrent On trigger exit behavoiur in game build

Got a weird bug. I Have a script which monitors the position of a part to see if it is overlapping with another part using OnTriggerEnter and OnTriggerExit. In the unity editor the script works perfectly and OnTriggerExit is called every time without fail.

However when I build and run my game for windows standalone x86 OnTriggerEnter is called just fine but OnTriggerExit is never called. (I put a debug log to make sure).

Does anyone know what may cause this bug or a workaround? I know i could use OnTriggerStay, but this brings about some different issues.

Thanks for any help,


After backing my head against a wall for the past 4 hours I finally found the cause. I had the script debugging check box ticked on the build properties. Somehow this was the cause as disabling it causes the OnTriggers to work as expected.

Thought i would post the answer in case someone else has this annoying but rare problem.