void Update() { if (startNotificationTimer) { notificationTimer += Time.deltaTime; } if (notificationTimer >= notificationThreshold) { notificationBox.text = ""; startNotificationTimer = false; notificationTimer = 0f; } if (Input.GetKeyDown(KeyCode.Return)) { SubmitLeaderboardScore(); } if (startLoading) { loadTimer += Time.deltaTime; } if (loadTimer >= loadThreshold) { HSController.startGetScores(); startLoading = false; loadTimer = 0f; } if (setTheScore) { if (!startLoading) { if (localPassword == HSController.retrievedID || HSController.retrievedID == "" || HSController.retrievedID == null) { HSController.startGetCurrentScore(); startLoading = true; startScoring = true; } else { notificationBox.text = "WRONG PASSWORD!"; ClearNotificationBox(); // Debug.Log("WRONG PASSWORD!"); } setTheScore = false; } } if (startScoring && !startLoading) { // Debug.Log("LOCAL SCORE: " + localScore); //Debug.Log("RETRIEVED SCORE: " + HSController.retrievedScore); if (localScore < HSController.retrievedScore) { HSController.startPostScores(); scoresPosted = true; startLoading = true; } else { notificationBox.text = "your best is higher or equal!"; ClearNotificationBox(); // Debug.Log("SCORE IS LOWER"); } startScoring = false; } if (scoresPosted && !startLoading && successStarted) { HSController.startGetScores(); successText = "SUCCESS!"; scoresPosted = false; successStarted = false; setSuccessText = true; rememberMe.shouldUserBeRemembered = true; } if (setSuccessText) { //setting the text like this because setting the text after HSController.startGetScores() caused a null reference exception. notificationBox.text = successText; ClearNotificationBox(); } }