public void Damage(int damage) { hp -= damage; if (hp <= 0) { Debug.Log("Dead"); if (ragdoll != null) { Transform t = Instantiate(ragdoll, transform.position, transform.rotation).transform; t.parent = transform.parent; } if (dcont != null) { dcont.spawn_chest(); } Destroy(gameObject); } }