구글링을 해보았더니, 나와 똑같은 의문을 가진 개발자가 있었다.
유니티 포럼에서도 여러 의견이 나뉘는데, 내가 봤을 때는 1 => 2 => 3 순으로 느리다.
따라서 유니티 인스펙터에 컴포넌트를 걸어두고 사용하자!
참고 문서
https://docs.unity3d.com/ScriptReference/Transform.GetChild.html
Unity - Scripting API: Transform.GetChild
If the transform has no child, or the index argument has a value greater than the number of children then an error will be generated. In this case "Transform child out of bounds" error will be given. The number of children can be provided by childCount.
docs.unity3d.com
https://docs.unity3d.com/ScriptReference/GameObject.Find.html
Unity - Scripting API: GameObject.Find
This function only returns active GameObjects. If no GameObject with name can be found, null is returned. If name contains a '/' character, it traverses the hierarchy like a path name. For performance reasons, it is recommended to not use this function eve
docs.unity3d.com
'Engine > Unity' 카테고리의 다른 글
유니티 GameObject.FindGameObjectWithTag("Player") (0) | 2023.02.11 |
---|---|
유니티 Billboard Renderer 직접 구현할 필요가 없다 (0) | 2023.02.11 |
유니티 Camera.main은 캐싱해서 쓰자 (0) | 2023.02.11 |
유니티 [ExecuteInEditMode]로 플레이 하지 않은 상태에서 값 변경하기 (0) | 2023.02.11 |
유니티 인스펙터 창에 속성들 구분하는 [Header()] (0) | 2023.02.11 |