unity www get request code example
Example: 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);
}
}