docs(BT12-Dev-Vis): Projectile null guard·자성 #10 (엔트리 21)

EerieVillage 1437720 push 정합.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
깃 관리자 2026-05-13 20:13:26 +09:00
parent 0893c28a50
commit 13d80cd1ad
2 changed files with 24 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -525,6 +525,29 @@ if (other.GetComponent<Projectile>() != null) return;
---
## 엔트리 21 — Projectile NullReferenceException + 잔존 근본 fix (2026-05-13 EerieVillage `1437720`)
**PD 보고**: `NullReferenceException Projectile.cs:187` + 맵 영역 잔존 투사체 2개.
**근본 원인 (직전 진단 Debug.Log 영역 영역 영역 추적 X 영역 영역 추정)**:
- `ProjectileSpawner.Trigger` 영역 GO 생성 후 호출 순서:
1. `Instantiate`/`CreateFallbackProjectile` (GO 영역)
2. `BoxCollider2D` 부착·**`isTrigger=true`** 활성
3. `box.size = HitboxSize` 설정
4. **`proj.Initialize(...)` 호출** (← `_runtime`·`_data` 영역 set)
- 단계 2·3 영역 isTrigger=true 활성 직후 영역 = Unity 영역 동일 frame 영역 OnTriggerEnter2D 발화 가능 (인근 collider 영역 trigger volume 영역 영역) → `_runtime == null``_runtime.CalculateEffectiveDamage()` NullReferenceException
- exception 영역 OnTriggerEnter2D 영역 throw → SelfDestruct 호출 X → invoke lifetime (5초) 영역 영역 영역 자동 소멸 영역 영역 영역 영역 → **영구 잔존**
**fix**:
- `OnTriggerEnter2D` 영역 **첫 줄** `if (_runtime == null || _data == null) return;` defensive
- `Update` 영역 `_data == null` 시 즉시 SelfDestruct (Initialize 호출 영역 X·잔존 영역 영역)
**본 PM 자성 #10** — race condition (collider 활성 시점 vs Initialize 호출 시점) 사전 측정 누락. ProjectileSpawner.Trigger 영역 코드 영역 순서 영역 영역 검증 X.
**잔상 정합 가능 영역**: 진단 Debug.Log (`SelfDestruct`·`OnDestroy`) 영역 본 fix 정합 영역 영역 안정 후 추가 commit 영역 revert 영역.
---
## 영역 자산
- `HitboxDebug.cs` 공용 helper (Spawn·AttachToTransform·GetWhiteSprite) — 추후 다른 카테고리 (C 설치·D 소환·E 오라) 영역 박스 시각화 재사용 가능.