BT5-Dev #18: Player 영역 fallback FindFirstObjectByType + allPCcount 진단
This commit is contained in:
parent
ce202ea8cb
commit
4dd58c04f7
|
|
@ -69,10 +69,21 @@ namespace Platformer.Mechanics
|
|||
// PD 지시 2026-05-07 — Player ↔ Enemy 통과 가능이지만 Bounds.Intersects로 매 프레임 감지
|
||||
if (_cachedPlayer == null)
|
||||
{
|
||||
// 1차: tag 영역 발견
|
||||
var pgo = GameObject.FindGameObjectWithTag("Player");
|
||||
if (pgo != null) _cachedPlayer = pgo.GetComponent<PlayerController>();
|
||||
|
||||
// 2차 fallback: tag 영역 미설정 영역에 대비해 PlayerController 영역 직접 검색
|
||||
if (_cachedPlayer == null)
|
||||
{
|
||||
_cachedPlayer = Object.FindFirstObjectByType<PlayerController>();
|
||||
}
|
||||
|
||||
if (Time.frameCount % 60 == 0)
|
||||
Debug.Log($"[BT17-Update@{name}] f={Time.frameCount} cached={(_cachedPlayer != null ? _cachedPlayer.name : "NULL")}");
|
||||
{
|
||||
int allCount = Object.FindObjectsByType<PlayerController>(FindObjectsSortMode.None).Length;
|
||||
Debug.Log($"[BT17-Update@{name}] f={Time.frameCount} cached={(_cachedPlayer != null ? _cachedPlayer.name : "NULL")} pgoTag={(pgo != null ? pgo.name : "NULL")} allPCcount={allCount}");
|
||||
}
|
||||
}
|
||||
if (_cachedPlayer != null && _cachedPlayer.health != null && _cachedPlayer.health.IsAlive)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue