public override void TakeDamage(int damage) { currentHealth -= damage; DamageNumber dn = Instantiate(damageNum, damageNum.GetComponentInParent <Canvas>().transform, true); float rand = Random.Range(-1f, 1f); dn.transform.position = gameObject.transform.position; dn.transform.position += new Vector3(rand, 0); dn.SetActive(true); if (currentHealth <= 0) { Destroy(gameObject); } }