Hi guys,
I’m experiencing something weird. This simple if statement gives me a non-correct output.
if(lifeTime < 0f)
{
GameObject.FindWithTag("GameController").GetComponent<EnemySpawnScript>().enemyOnScreen -= 1;
Destroy(gameObject);
}
The subtraction on the variable enemyOnScreen is done two times instead of one. How’s this possible if the object is immediately destroyed after the subtraction?