728x90
GetComponentsInChildren은 GameObject의 자식을 모두 뽑아내는 유용한 메소드다.
T child = gameObject.GetComponentsInChildren<T>(); 꼴로 사용할 수 있다.
T 값으로 Text를 사용할 경우 그냥 Text를 T에 넣어주면 된다.
하지만 TextMeshPro의 경우 반드시!!! T에 TextMeshProUGUI를 넣어야 한다.
이걸 몰라서 정말 한참동안 오류를 찾아 헤맸다. 바보는 나 하나로 족하다.😂
728x90
'공부 > Unity' 카테고리의 다른 글
[Unity] testrunner.dll does not exist - 2 (0) | 2022.05.02 |
---|---|
[Unity] CSharp.dll does not exist (0) | 2022.05.02 |
[Unity] unity visual studio 연결 - 대상 프레임워크가 설치되지 않음 오류 (0) | 2022.05.02 |
[Unity] All compiler errors have to fixed before you can enter playmode! 오류 해결 (0) | 2022.05.02 |
[Unity] No Sprite Editor Window registered. 해결하기 (0) | 2022.05.02 |