public void EnemyHit(bool isPlayerOne) { GameObject field; //uses appropriate bubble color if (isPlayerOne) { field = Instantiate(fieldWithMonsterYellow); } else { field = Instantiate(fieldWithMonsteRed); } //add points to player for killing the monster ps.AddPoints(isPlayerOne, killPoints); //tell monster spawner the monster is dead ms.DecreaseMonsterCount(); //spawns filled field a little above monster so it doesnt get stuck to a platform field.transform.position = this.transform.position + new Vector3(0f, 0.1f, 0f); Destroy(gameObject); }