C
C#10mo ago
Funduk

Code no working

using TMPro; using UnityEditor.Experimental.GraphView; using UnityEngine; using UnityEngine.UIElements; public class LoseWindow : MonoBehaviour { public TextMeshProUGUI scoreText; public TextMeshProUGUI bestScoreTXT; public Medal[] medals; public Image medalDisplay; public void PlayerLose() { int score = ScoreManager.Instance.score; scoreText.text = score.ToString(); int bestScore = PlayerPrefs.GetInt(key:"BestScore"); if (score > bestScore) { bestScore = score; } for (int i = 0; i < medals.Length; i++) { if (medals[i].SporeNeed <= score) { if (i > 0) { medalDisplay.gameObject.SetActive(true); medalDisplay.sprite = medals[i].MedalSprite; } else break; } } bestScoreTXT.text = bestScore.ToString(); PlayerPrefs.SetInt("BestScore", bestScore);
} }
4 Replies
Denis
Denis10mo ago
$details
MODiX
MODiX10mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, what you expect the result to be, what .NET version you are using and what platform/environment (if any) are relevant to your question. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Denis
Denis10mo ago
Also, there is a dedicated $unity discord

Did you find this page helpful?