From 1437720e50cb3191a18b8607f85cc518c069a0f2 Mon Sep 17 00:00:00 2001 From: swrring Date: Wed, 13 May 2026 20:12:51 +0900 Subject: [PATCH] =?UTF-8?q?fix(BT12-Dev):=20Projectile=20NullReferenceExce?= =?UTF-8?q?ption=20+=20=EC=9E=94=EC=A1=B4=20fix=20(PD=20=EB=B3=B4=EA=B3=A0?= =?UTF-8?q?=202026-05-13)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 원인: ProjectileSpawner.Trigger 영역 BoxCollider2D.isTrigger=true 활성 (단계 2) 직후·Initialize (단계 3) 이전 OnTriggerEnter2D 발화 가능 → _runtime=null → NullReferenceException line 187 → SelfDestruct 미호출 → 영구 잔존. fix: 1. OnTriggerEnter2D 영역 `_runtime == null || _data == null` defensive return 2. Update 영역 `_data == null` 시 즉시 SelfDestruct (잔존 차단) 본 PM 자성 #10 — race condition 사전 측정 누락. ProjectileSpawner.Trigger 영역 collider 부착 시점·Initialize 호출 시점 영역 사이 OnTriggerEnter2D 발화 가능성 사전 측정 X. Co-Authored-By: Claude Opus 4.7 (1M context) --- Assets/Scripts/Skills/Effectors/Projectile.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Assets/Scripts/Skills/Effectors/Projectile.cs b/Assets/Scripts/Skills/Effectors/Projectile.cs index c2ffe36..78ad173 100644 --- a/Assets/Scripts/Skills/Effectors/Projectile.cs +++ b/Assets/Scripts/Skills/Effectors/Projectile.cs @@ -124,6 +124,13 @@ namespace EerieVillage.Skills.Effectors protected virtual void Update() { + // PD 지시 2026-05-13 — Initialize 호출 이전 Update 발화 차단·_data null 시 즉시 SelfDestruct (잔존 차단) + if (_data == null) + { + SelfDestruct(); + return; + } + // PD 지시 2026-05-13 — Inspector HitboxSize 변경 즉시 반영 SyncHitboxToData(); @@ -162,6 +169,10 @@ namespace EerieVillage.Skills.Effectors protected virtual void OnTriggerEnter2D(Collider2D other) { + // PD 지시 2026-05-13 — Initialize 호출 이전 OnTriggerEnter2D 발화 영역 NullReferenceException 차단 + // ProjectileSpawner.Trigger 영역 collider 부착 후 Initialize 호출 영역 race 영역 영역 발화 가능 + if (_runtime == null || _data == null) return; + if (_hitTargets.Contains(other)) return; // PD 지시 2026-05-13 — 투사체끼리 충돌 X·통과 정합 (Projectile 컴포넌트 동족 skip·Wall 판정 이전)