fix 이미지 다운로드 전에 모달 활성화시 이미지 반영안되는 문제 해결

This commit is contained in:
이정수 2025-02-08 09:25:59 +09:00
parent db8d0e9eaa
commit 47f51a84f5
2 changed files with 24 additions and 3 deletions

View File

@ -1,4 +1,6 @@
using System.Collections;
using TMPro; using TMPro;
using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
@ -14,10 +16,12 @@ public class ModalCtrl : MonoBehaviour
[SerializeField] TMP_Text suitStyle; [SerializeField] TMP_Text suitStyle;
[SerializeField] GameObject[] colors; [SerializeField] GameObject[] colors;
public void Set(Library library) public void Set(Library library)
{ {
gameObject.SetActive(true); gameObject.SetActive(true);
suitImage.texture = library._suit_image; StartCoroutine(checkImageUpdate(library));
suitImage.SetNativeSize(); suitImage.SetNativeSize();
RectTransform rect = suitImage.gameObject.GetComponent<RectTransform>(); RectTransform rect = suitImage.gameObject.GetComponent<RectTransform>();
rect.anchorMin = new Vector2(0.5f, 0.5f); rect.anchorMin = new Vector2(0.5f, 0.5f);
@ -31,5 +35,23 @@ public class ModalCtrl : MonoBehaviour
debutDate.text = library.production_date; debutDate.text = library.production_date;
suitType.text = library.suit_type; suitType.text = library.suit_type;
suitStyle.text = library.suit_style; suitStyle.text = library.suit_style;
}
void OnDisable()
{
StopAllCoroutines();
}
IEnumerator checkImageUpdate(Library library)
{
while(library._suit_image == null)
{
yield return null;
}
suitImage.texture = library._suit_image;
} }
} }

View File

@ -276,8 +276,7 @@ public class SearchCtrl : SingletonMonoBehaviour<SearchCtrl>
await request.Send(); await request.Send();
await tcs.Task; await tcs.Task;
return library._suit_image; return library._suit_image;
} }