• 카테고리

    질문 & 답변
  • 세부 분야

    게임 프로그래밍

  • 해결 여부

    미해결

UI_Base 질문

24.02.14 01:29 작성 24.02.14 01:30 수정 조회수 159

0

protected void Bind<T>(Type type) where T : UnityEngine.Object

{

string[] names = Enum.GetNames(type);

UnityEngine.Object[] objects = new UnityEngine.Object[names.Length];

_objects.Add(typeof(T), objects);

for (int i = 0; i < names.Length; i++)

{

if (typeof(T) == typeof(GameObject))

objects[i] = Util.FindChild(gameObject, names[i], true);

else

objects[i] = Util.FindChild<T>(gameObject, names[i], true);

if (objects[i] == null)

Debug.Log($"Failed to bind({names[i]})");

}

}

 

 

 

에서 순서가

 

 

for (int i = 0; i < names.Length; i++)

{

if (typeof(T) == typeof(GameObject))

objects[i] = Util.FindChild(gameObject, names[i], true);

else

objects[i] = Util.FindChild<T>(gameObject, names[i], true);

if (objects[i] == null)

Debug.Log($"Failed to bind({names[i]})");

}

로 object에 value를 findchild로 먼저 다 넣어주고

그 뒤에 objects.add로 dic형태 _objects에다 채워주어야 하지않나요?

 

상관없나요?

답변 1

답변을 작성해보세요.

0

참조값이라 상관없습니다.