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; }
- ๋ฆฌ์คํธ :
- index
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
'๐ฎUnity' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[VR] ๊ฐ๋ฐ ํ๊ฒฝ ์ค์ - OVR (0) | 2022.07.31 |
---|---|
Graphics / Line (0) | 2022.07.31 |
[Unity] ์ค์ต_UI, Scene Management (0) | 2022.07.31 |
[Unity] ์ค์ต_Property, Memory, Hacks (0) | 2022.07.31 |
[Unity] ๊ธฐ๋ณธ ๋ค์ง๊ธฐ_๋ฌผ๋ฆฌ, Life Cycle, ๊ธฐ๋ณธ ์ฉ์ด (0) | 2022.07.31 |
๋๊ธ