So I’ve looked around for different ways to fix this issue. I’ve tried setting up bools to make sure the increment only happens once, tried adding an OnCollisionExit entry in conjunction with the first option, and even tried rethinking out the logic. However, nothing I seem to do fixes this issue and I’m at a loss for what is causing it right now.
Here is my OnCollision Function:
void OnCollisionEnter(Collision col)
{
//Ally
if (col.gameObject.tag == "Ally")
{
//Increment Slaves Freed
gameManager.SlavesFreed += 1;
//Update Visual HUD Counter
SetCountText();
//Destroy GameObject
Destroy(col.collider);
Destroy(col.rigidbody);
Destroy(col.gameObject);
}
}
Here is the OnTrigger:
void OnTriggerEnter(Collider col)
{
//PowerUp
if (col.gameObject.tag == "Powerup")
{
magicUses += 1;
Destroy(col.gameObject);
SoundManager.instance.PlaySingle(powerupSound);
}
}
EDIT: For those stopping in and looking for a solution to this as well, take a look at ScaniX’s comments. It will help lead you down the right path to finding an issue.
My problem solved and I’m not sure what was different, but it could help you with your issue