inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

173만명의 커뮤니티!! 함께 토론해봐요.

UI_Inven에서 Bind시 오류가 발생합니다

해결됨

[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part3: 유니티 엔진

UI_Inven에서 Bind<GameObject>(typeof(GameObjects));를 할 때 오류가 떠서 breakpoint를 잡아보니 이 부분의 foreach문 에서 오류가 발생합니다 ArgumentException: GetComponent requires that the requested component 'GameObject' derives from MonoBehaviour or Component or is an interface. UnityEngine.GameObject.GetComponentsInChildren[T] (System.Boolean includeInactive) (at <4a31731933e0419ca5a995305014ad37>:0) UnityEngine.GameObject.GetComponentsInChildren[T] () (at <4a31731933e0419ca5a995305014ad37>:0) Util.FindChild[T] (UnityEngine.GameObject go, System.String name, System.Boolean recursive) (at Assets/Scripts/Utils/Util.cs:43) UI_Base.Bind[T] (System.Type type) (at Assets/Scripts/UI/UI_Base.cs:23) UI_Inven.Init () (at Assets/Scripts/UI/PopUp/UI_Inven.cs:21) UI_Inven.Start () (at Assets/Scripts/UI/PopUp/UI_Inven.cs:14) Bind할 때 GameObject가 아닌 Transform으로 Bind를 해보니 오류 없이 정상적으로 작동했습니다 해결은 했지만 강의에서는 GameObject를 받아서 잘 되었는데 저는 안 되는 건지 궁금해서 질문을 남겨봤습니다.. 강의랑 버젼이 달라서 그런 것인가요??

  • UI_Inven
  • unity
  • C#
1O1D 댓글 1 좋아요 0 조회수 1382

base.Init() 질문이 있습니다.

미해결

[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part3: 유니티 엔진

정말 좋은 강의 감사합니다. unity 강좌를 2번째 보면서 코드를 하나하나 보고 있습니다. 상속성에 대해서 이해가 안가서 질문 드립니다. UI_Inven에 Init() -> base.Init()을 들어가면 부모 UI_Scene에 들어가서 Managers.UI.SetCanvas( gameObject , false); 를 해주는데 gameObject 가 왜 UI_Inven이 들어가는지 잘 모르겠습니다 . 원래 자식클래스에서 초기화를 하면 부모 클래스의 gameobject가 자식 스크립트(UI_Inven)를 받는 건가요?

  • UI_Inven
  • unity
  • C#
InJ 댓글 1 좋아요 0 조회수 382

인기 태그

인프런 TOP Writers

주간 인기글