ComponentList 개발 중

This commit is contained in:
logonkhi
2025-08-11 14:58:18 +09:00
parent bf10b6f94a
commit 7c821a3a39
15 changed files with 2686 additions and 394 deletions

View File

@@ -163,18 +163,20 @@ namespace UVC.Pool
}
}
if (_recycledItems.Count > 0)
while (_recycledItems.Count > 0)
{
item = _recycledItems[0];
item = _recycledItems[0]; //부모가 삭제 되면 null이 될 수 있습니다.
_recycledItems.RemoveAt(0);
if (item != null) break; // 유효한 아이템을 찾았으므로 루프를 종료합니다.
// item이 null이면, 해당 아이템은 파괴된 것으로 간주하고 다음 아이템을 확인합니다.
}
else
if (item == null)
{
lock (_statsLock)
{
_poolMisses++;
}
GameObject go = UnityEngine.Object.Instantiate(_originalPrefab);
item = go.GetComponent<T>();
}

View File

@@ -176,13 +176,16 @@ namespace UVC.Pool
}
}
if (_recycledItems.Count > 0)
while (_recycledItems.Count > 0)
{
// 재활용 목록에 아이템이 있으면 가져와서 사용합니다.
item = _recycledItems[0];
item = _recycledItems[0]; //부모가 삭제 되면 null이 될 수 있습니다.
_recycledItems.RemoveAt(0);
if (item != null) break; // 유효한 아이템을 찾았으므로 루프를 종료합니다.
// item이 null이면, 해당 아이템은 파괴된 것으로 간주하고 다음 아이템을 확인합니다.
}
else
if (item == null)
{
// 재활용 목록이 비어있으면 새로 생성합니다.
lock (_statsLock)