Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Bug Unity 6: Cannot resolve destination host

Discussion in 'Windows' started by Armend, May 22, 2024.

  1. Armend

    Armend

    Joined:
    Aug 8, 2015
    Posts:
    12
    Hi! I need help regarding an error I am getting on Unity6 IN the editor.

    The code worked last time I used it, but it was not on Unity6. After the change, it seems that the URL is not reachable anymore. I tested it with other URLs on testrequests, but the same error occured.

    Is there a setting anywhere which I have to configure in Unity6?

    Here is the test request:



    IEnumerator TestGetRequest()
    {
    string testUrl = "https://jsonplaceholder.typicode.com/todos/1";
    UnityWebRequest testRequest = UnityWebRequest.Get(testUrl);

    yield return testRequest.SendWebRequest();

    if (testRequest.result == UnityWebRequest.Result.ConnectionError ||
    testRequest.result == UnityWebRequest.Result.ProtocolError)
    {
    Debug.LogError("Error: " + testRequest.error);
    }
    else
    {
    Debug.Log("Test Request Success");
    Debug.Log("Response: " + testRequest.downloadHandler.text);
    }
    }

    I get the error:
    "Cannot resolve destination host"

    I would appreciate any help!
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    7,004
    Perhaps a temporary downtime of the server or your connection?

    PS: please put code in code tags for readability.
     
  3. Armend

    Armend

    Joined:
    Aug 8, 2015
    Posts:
    12
    Okay, this is somehow embarassing. My 2 years old son pressed the power button on my PC resulting in it starting to shut down. I have managed to click the "abort" button to not let it shut down since I would lose the changes on my project.
    It happens to be, that this "midway shutdown" had already somehow shut down processes that where needed for Unitys WebRequest to work.
    So, just restarting the PC fixed the bug :'). Hours of bug-search for nothing.

    For the unlikely - but maybe possible - situation someone get's the same mistake.
     
    bugfinders likes this.