// Update is called once per frame void FixedUpdate() { //invincibility frames after being hit if (invincible > 0) { invincible -= 1; } //enemy death if (hp <= 0) { if (isBoss) { Instantiate(BossFinalForm, transform.position, transform.rotation); } else if (isFinalBoss) { WinManager winScript = GameObject.FindWithTag("Manager").GetComponent <WinManager>(); winScript.win(); } else { spawnPickup(); } gameObject.SetActive(false); } }