Search Unity

Other Api

Discussion in 'Editor & General Support' started by Ze1ro, Nov 29, 2022.

  1. Ze1ro

    Ze1ro

    Joined:
    Jul 28, 2022
    Posts:
    8
    hello when i put this code
    HttpWebRequest request = (url);
    HttpWebResponse responce = (HttpWebResponse)request.GetResponse();
    StreamReader reader = new StreamReader(responce.GetResponseStream());

    It freezes when on the web platform
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,911
    You should not do Network I/O or any other type of I/O operation on the main thread. This is general advice for any user facing interactive application. Look into UnityWebRequest for a simple asynchronous solution.
     
  3. Ze1ro

    Ze1ro

    Joined:
    Jul 28, 2022
    Posts:
    8
    Thank you it works now