Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

WWW is not ready downloading yet

Discussion in 'Scripting' started by grady-lad, Apr 13, 2012.

  1. grady-lad

    grady-lad

    Joined:
    Apr 13, 2012
    Posts:
    7
    Hey guys I am new to Unity, and have a problem downloading a response from my webpage. Basically I have a two textfields which get username and password and register these details to a database. The entries are being added to database fine. But when I try to get a response from my PHP page indicating whether the registration was successful ( 1 meaning successful, 2 meaning unsuccessful) I keep getting an error "WWW is not ready downloading yet". I know that yield will wait for the download to complete but I cannot use this because I am using the OnMouseUp( ) method. Does anyone have any suggestions on how to overcome this problem ? Cheers to anyone who can help. OnMouseUp( ) code below.

    Code (csharp):
    1. void OnMouseUp(){
    2.                
    3.         print (post_url);
    4.         WWW hs_post = new WWW(post_url);   
    5.        
    6.         string wassup = hs_post.text;
    7.         print (wassup);
    8.              
     
  2. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    OnMouseUp is irrelevant.

    Code (csharp):
    1.  
    2. void OnMouseUp()
    3. {
    4.     StartCoroutine(DoWWW());
    5. }
    6.  
    7. private IEnumerator DoWWW()
    8. {
    9.     WWW hs_post = new WWW(post_url);
    10.     yield return hs_post;
    11.     print(hs_post.text);
    12. }
    13.  
     
  3. grady-lad

    grady-lad

    Joined:
    Apr 13, 2012
    Posts:
    7
    sorry for the late reply thanks for the help it worked a charm
     
  4. PLL

    PLL

    Joined:
    Jul 15, 2013
    Posts:
    19
    I actually use the code with the "yield return www;" but it still returns the same error. I was expecting it to wait but it does not and returns the same error. Any clue? :)
     
  5. ei1

    ei1

    Joined:
    Apr 26, 2015
    Posts:
    1
    Unity crashes every time it reaches "yield return www". unity 5.3.4
     
  6. supershwa

    supershwa

    Joined:
    Feb 10, 2013
    Posts:
    12
    Having the same problem in Unity 5.5.1 -- did not use to happen
     
  7. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,748
    Paste your code