Ive tried every possible combination of colliders and ridigidbodys but this just does not work it will sometimes just keep the bool true why does it do this and what can i do to work around it
void OnTriggerEnter(Collider collisionInfo) {
if (collisionInfo.gameObject.tag == "Water") {
inWater = true;
}
}
void OnTriggerExit(Collider collisionInfo) {
if (collisionInfo.gameObject.tag == "Water") {
inWater = false;
}
}
Possibly a horrible hack, put perhaps use a combination of OnTriggerStay and LateUpdate?
In the OnTriggerStay test for water and set inWater to true as you are doing. Then in a LateUpdate reset it back to false. As I say, not the most eligant sollution but hopefully something that might work around your current issue.
I wonder if the issue you are seeing is due to the collider moving out of the water and back in within the same update and confusing the collision system? Is your player movement being done within Update or FixedUpdate?