적과 총알 그리고 이펙트까지 빈번하게 생성되고 사라지기 때문에 게임 상에 부하가 생긴다.
이 3가지를 캐싱하여 프리팹 Instantiate를 줄여 부하를 줄인다.
public class PrefabCacheSystem
{
Dictionary<string, Queue<GameObject>> Caches = new Dictionary<string, Queue<GameObject>>();
public void GenerateCache(string filePath, GameObject gameObejct, int cacheCount)
{
...
}
public GameObject Archive(string filePath)
{
...
}
public bool Restore(string filePath, GameObject gameObject)
{
...
}
부하가 생길 수 있는 상황들