wip: try to fix local i issue

This commit is contained in:
Fangh 2024-01-29 21:01:09 +01:00
parent 274d4cc3dc
commit fa45a83124

View File

@ -18,18 +18,19 @@ public void ShowQuestion(Question currentQuestion)
{
List<Proposition> props = currentQuestion.propositions.Values.ToList();
promptLabel.text = prompts.GetPromptById(currentQuestion.promptId).en;
for (int i = 0; i < 2; i++)
{
int index = i; // Capture la valeur de i pour cette itération
StorageManager.ConvertGoogleStorageURLToHttpsUrl(props[i].photoUrl, _httpURL =>
{
StartCoroutine(StorageManager.DownloadImage_Coroutine(_httpURL, (Texture texture) =>
{
Sprite sprite = Sprite.Create(texture as Texture2D, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
btns[i].sprite = sprite;
btns[index].sprite = sprite; // Utilise l'index local au lieu de i
}));
});
}
}
}