im not to sure how to describe this accurately, but i have a trigger box collider around my player controller and a trigger sphere collider around an ammo crate which is supposed to re-supply your ammo when you hit ‘E’ near it. i was debugging the variable which basically says that the player is near the ammo box when i noticed that clicking either mouse button changes the variable to false for seemingly no reason, also the variable doesn’t change to false when i leave the trigger radius.
here’s the relevant code for the player controller:
void OnTriggerEnter(Collider other) {
if(other.gameObject.tag == "AmmoCrate") {
nearbox = true;
}
else
{
nearbox = false;
}
}
not sure if there is any other code i need to paste, but feel free to ask if there is.
thanks in advance to any helpers, this is driving me nuts.