private IEnumerator LoginAsync(string username, string password) { UnityWebRequest loginRequest = APIHelper.AttemptLogIn(username, password); yield return(loginRequest.SendWebRequest()); if (loginRequest.responseCode == 200) { VariableHolder.User.UserID = int.Parse(loginRequest.downloadHandler.text); VariableHolder.User.Username = username; VariableHolder.User.Password = password; logInButtonText.text = "Log Out"; onlineButton.interactable = true; registerButton.interactable = false; loginResultLabel.text = "Login successful."; } else { loginResultLabel.text = "Invalid username or password"; } menuControl.GoToPreviousState(); menuControl.OnStateChanged(MenuStates.MainMenuLoginResult, false); }