배열의 내용을 삭제하는 여러가지 함수들
1. Remove("Value")
- 배열 내의 특정 값을 제거한다. 만약 List내에 중복되는 값이 있으면 첫 번째 항목만 제거, 나머지는 유지됨.
2. RemoveAt(index)
- 배열 내의 특정 index를 제거한다. 제거된 후, List의 크기는 자동적으로 줄어든다. (동적할당, 정적할당 모두 줄어듬)
3. RemoveAll()
- 함수 이름 그대로 List내의 모든 요소를 다 삭제함.
4. RemoveRange( start, end)
- List안에서의 구간 삭제, 삭제할 처음 index 번호와 끝 index 번호가 필요함.
'C#, Unity' 카테고리의 다른 글
| C#, Unity) 애니메이션 GetCurrentAnimatorStateInfo (2) | 2024.11.10 |
|---|---|
| C#, Unity) Activation / Diactivation Functions - SetActive, enabled, activeSelf, OnEnable, OnDisable (1) | 2024.08.22 |
| C#, Unity) IEnumerator, Coroutine, Lerp 함수 (1) | 2024.08.12 |
| C#, Unity) 범위 안 Enemy 판별 (1) | 2024.07.13 |