Quantcast
Channel: Questions in topic: "webrequest"
Viewing all articles
Browse latest Browse all 387

Finish UnityWebRequest before going further in Code

$
0
0
Hello people! The last few days i struggled with the following problem: my output should look like this -> First Log, Second Log some response data, Third log But in fact it always looks like this -> First Log, Third Log, Second Log some response data I have litteraly searched the whole internet but i didnt found a solution. Can anyone help me please? :) Best regards Alex using UnityEngine; using System.Collections; using UnityEngine.Experimental.Networking; using UnityEngine.Networking; public class Test : MonoBehaviour { void Start() { Debug.Log("First Log"); StartCoroutine(GetText()); Debug.Log("Third Log"); } IEnumerator GetText() { string url = "some url"; UnityWebRequest www = UnityWebRequest.Post(url,"some Data"); yield return www.SendWebRequest(); if (www.isError) { Debug.Log(www.error); } else { // Show results as text Debug.Log("Second Log: " + www.downloadHandler.text); // Or retrieve results as binary data //byte[] results = www.downloadHandler.data; // Debug.Log(results); } } }

Viewing all articles
Browse latest Browse all 387

Trending Articles