public void SetAlive(bool isAlive) { if (started == false) { started = true; } else if (currentAlive == isAlive) { return; } currentAlive = isAlive; foreach (MonoBehaviour behaviour in aliveBehaviours) { behaviour.enabled = isAlive; } if (isAlive == false) { RagdollController newRagdoll = Instantiate(ragdollPrefab); newRagdoll.CopyPose(character.animator, character.equipment); if (isPlayer && character.movement.head != null) { //keep the camera character.movement.head.SetParent(null); } Destroy(gameObject); } }