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. I have a really similar script (it's almost the same to be honest) that works perfectly, but I can't figure out how to make this script work.
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 --;
}
enemyCountt
script is attached to a gameobject in your scene? \$\endgroup\$ – Hellium Nov 29 '17 at 14:03