ObjectPool
- ๋ฉ๋ชจ๋ฆฌ ๋จํธํ/ํํธํ Memory Fragmentation ํ์ ๋ฐ์ ⇒
GameObject factory = Resources.Load<GameObject>(name); //Generic
GameObject factory = (GameObject)Resources.Load(name); //Typecast
GameObject factory = Resources.Load(name) as GameObject;
- ์๋ฃ๊ตฌ์กฐ
- ๋ฐฐ์ด : ์ฐ์๋ ๊ณต๊ฐ
- 1์ฐจ์ ๋ฐฐ์ด, 2์ฐจ์ ๋ฐฐ์ด, 3์ฐจ์ ๋ฐฐ์ด ...
- index
int[] a = new int[5];
for (int i = 0; i < a.Length; i++)
{
a[i] = 0;
}
- ๋ฆฌ์คํธ :
int count = 5;
List<int> list = new List<int>();
for (int i = 0; i < count; i++)
{
list.Add(0);
}
// list.insert
// list.Remove
// list.Removeat
- value type - ๊ฐ ํ์
- reference type - ์ฐธ์กฐ ํ์ (์ฃผ์ ๊ธฐ์ต)
- ํด์
- index ์ ๋ณด(์ ์, ๋ฌธ์ etc.) → ๊ฐ๊ณต(ํด์ํจ์) → ๋ฒํธ๋ก ๋ฝ์ ๋
HACKS
๐ก Alt + Enter ⇒ Generate Method
๐ก Ctrl + Click ⇒ Move to Method
๐ก internal - Public in same assembly / private in different assembly
๋๊ธ