Score on Enemy Death

I found it very strange that the game scored on the creation of the enemies rather than the death of enemies. Took me a while to work it out but I sorted this by adding the following code to the KillEnemy method in the EnemyDamage script:

GameObject scoreHolder = GameObject.Find("Enemies");
EnemySpawner enemySpawner = scoreHolder.GetComponent<EnemySpawner>();
enemySpawner.score = enemySpawner.score + 5;

Now I am sure there is a better way of doing this, but this worked for me :slight_smile:

Privacy & Terms