I know this question was asked before, but no answer was given, so I thought I'd ask again. It seems something changed from 3.1 to 3.2 when it comes to OnTriggerExit. I have a character (rigidbody) that walks onto a platform with a trigger atop it. The trigger will see if the character is a player, and if so, parents the player to the platform. When the character leaves the trigger, the character is unparented to the platform. This worked perfectly in 3.1, but in 3.2, OnTriggerExit is no longer fired. Any idea why this is the case? It seems a few people are having this problem with the upgrade.
Try out this script I made, I was having the same problem with the conversion, it worked fine here.
public class Parentesco : MonoBehaviour
{
private bool alguemEntrou = false;
void Start()
{
}
void Update()
{
}
void OnTriggerEnter(Collider entrou)
{
if (!alguemEntrou)
{
entrou.transform.parent = gameObject.transform;
alguemEntrou = true;
}
}
void OnTriggerExit(Collider saiu)
{
alguemEntrou = false;
saiu.transform.parent = null;
}
}
I hope it helps, good luck!
Remedio