CasingMemoryPool.cs
public void Awake()
{
memoryPool = new MemoryPool(casingPrefab);
}
MemoryPool.cs
public MemoryPool(GameObject poolObject)
{
Debug.Log("MemoryPool");
Debug.Log(poolObject);
maxCount = 0;
activeCount = 0;
this.poolObject = poolObject;
poolItemList = new List<PoolItem>();
InstantiateObjects();
}
public void InstantiateObjects() //์ค๋ธ์ ํธํ ์์ฑ
{
maxCount += increaseCount;
for(int i = 0; i < increaseCount; ++i)
{
PoolItem poolItem = new PoolItem();
poolItem.isActive = false;
poolItem.gameObject = GameObject.Instantiate(poolObject);
poolItem.gameObject.transform.position = tempPosition;
poolItem.gameObject.SetActive(false);
poolItemList.Add(poolItem);
}
}
PlayerHUD.cs
if(Input.GetKeyDown(keyCodeEnter))
{
SceneManager.LoadScene("BossStage");
playerWeapons[0].GetComponent<CasingMemoryPool>().Awake();
MissionUI.SetActive(false);
Time.timeScale = 1;
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
PlayerCtrl.bIsSetUI = false;
bIsMission = false;
}
๋ณด์ค ์คํ ์ด์ง๋ก ์ ์ด๋ ํ ๋ CasingMemoryPool์ Awake ํธ์ถํ๋ฉด ๋ณด์ค ์คํ ์ด์ง ํ์ด๋ผ์ดํค ์์ poolItem์ค๋ธ์ ํธ๊ฐ ์์ฑ ๋์ด์ผํ๋๊ฑฐ ์๋๊ฐ์??
์๋ฌ๋ฉ์์ง ๋จ๋์ง ์ฐ์ ๋ณด๊ณ ์ค๊ฐ์ค๊ฐ Debug.Log ๋ฃ์ด์ ํจ์๊ฐ ์ค์ ๋ก ํธ์ถ๋๋์ง ๋ณด์