Answers for "unity html get request"

C#
2

unity html get request

// Call Method Through: StartCourotine(SendRequest());

IEnumerator SendRequest() 
{
	UnityWebRequest request = UnityWebRequest.Get("REQUEST_URL");
	yield return request.SendWebRequest();
 
	if(request.isNetworkError || request.isHttpError) {
      	// Error Occurred
		Debug.Log(request.error);
	}
	
  	else {
      	// Response can be accessed through: request.downloadHandler.text
		Debug.Log(request.downloadHandler.text);
	}
}
Posted by: Guest on May-25-2020

C# Answers by Framework

Browse Popular Code Answers by Language