diff --git a/Assets/Scripts/PropositionHandler.cs b/Assets/Scripts/PropositionHandler.cs index af251eb..2495f70 100644 --- a/Assets/Scripts/PropositionHandler.cs +++ b/Assets/Scripts/PropositionHandler.cs @@ -18,18 +18,19 @@ public void ShowQuestion(Question currentQuestion) { List 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 })); }); } + } }