how to send get request and return response in unity code example
Example: unity html 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);
}
}