Hi. I have a script that counts how many enemies are left and changes the scene when there are no more enemies. However, it doesn’t work, and i can’t find the error, specially because i have a really really similar (like almost the same to be honest) script in another scene and it’s working perfectly. Here’s the code:
public class enemyCountt : MonoBehaviour {
public static int enemiessCount = 5;
void Start () {
}
void Update (){
print("Enemy count is " + enemiessCount );
if(enemiessCount <= 0)
{
SceneManager.LoadScene ("bonus");
}
}
}
and this is attached to the bullet script:
if (collision.gameObject.tag == "Enemy") {
enemyCountt.enemiessCount --;
}