diff --git a/Assets/Scripts/UnitHealthBar.cs b/Assets/Scripts/UnitHealthBar.cs index 23866e4..82cdf27 100644 --- a/Assets/Scripts/UnitHealthBar.cs +++ b/Assets/Scripts/UnitHealthBar.cs @@ -170,12 +170,16 @@ namespace Northbound private void LateUpdate() { - // 타겟을 따라 이동 (회전은 하지 않음) - if (_targetTransform != null) + // 타겟이 파괴되면 체력바도 파괴 + if (_targetTransform == null) { - transform.position = _targetTransform.position + Vector3.up * heightOffset; + Destroy(gameObject); + return; } + // 타겟을 따라 이동 (회전은 하지 않음) + transform.position = _targetTransform.position + Vector3.up * heightOffset; + // 체력이 가득 차면 숨김 if (hideWhenFull && barContainer != null && _healthProvider != null && _initialized) {