How to get all children without the parent?
Transform[] drawns = GetComponentsInChildren<Transform>() This include also the parent but i want to get only the children of the transform the script is connected. The problem is that it's
stackoverflow.com
위 문서 답변에 잘 정리돼있다.
(최고의 지식인. 누구신지 모르지만 무한한 감사드립니다.)
해결방법
public Transform[] spawnPoints;
spawnPoints = GetComponentsInChildren<Transform>().Where(t => t != transform).ToArray();
인덱스 0를 지우는 것보다 위 방법이 나은 것 같아 선택하였다.
'Game Programming > Unity' 카테고리의 다른 글
유니티 비전프로 언바운디드 앱 예시 (0) | 2025.02.06 |
---|---|
[Unity3D] 효율적인 메모리 관리 - Occulusion Culling (0) | 2024.08.27 |
[유니티] 태그 비교: '==' vs 'CompareTag' (0) | 2024.03.20 |