private IEnumerator executeLogin() { Debug.Log("clicked"); AuthData auth = new AuthData(loginText.text, passwordText.text); String requestString = auth.toJson(); Debug.Log("requestString: " + requestString); System.Collections.Generic.Dictionary <string, string> headers = new System.Collections.Generic.Dictionary <string, string>(); headers.Add("Content-Type", "application/json"); var encoding = new System.Text.UTF8Encoding(); WWW request = new WWW(LOGIN_URI, encoding.GetBytes(requestString), headers); yield return(request); LoginResponse jResponse = JsonUtility.FromJson <LoginResponse>(request.text); hideProgress(); // Print the error to the console if (request.error != null) { Debug.Log("request error: " + request.error); showDialog("request error: " + request.error); } else { if (!String.IsNullOrEmpty(jResponse.message)) { Debug.Log("request error: " + jResponse.message); showDialog(jResponse.message); } else { AppGlobal.token = jResponse.token; AppGlobal.finalText = jResponse.finalText; AppGlobal.finalTextUrl = jResponse.finalTextUrl; AppGlobal.youtubeUrl = jResponse.youtubeUrl; SceneManager.LoadScene("MainMenu"); } } }