So, my problem is that when I use IEnumerator and i try to increase or decreases by one a variable the variable increases by 7 or 10, the IEnumerator script:
//I use this to call the coroutine
if(Input.GetKey(KeyCode.R) && mags > 0 && magBullets < 30) {
StartCoroutine(Reload());
}
//The IEnumerator
IEnumerator Reload() {
weaponAnimationHolder.clip = reloadAnim;
weaponAnimationHolder.Play(); // don't look to this one, it is just to play an animation
yield return new WaitForSeconds(3f); //wait for 3 seconds
magBullets = maxMagBullets; //all correct here
mags -= 1; // here is the problem, the variable "mags" decreases by 7 or 10
}
The “mags” variable is an int