Search Unity

Unity 5 - WWW forms do not work properly in WebPlayer (form is empty)

Discussion in 'Editor & General Support' started by Narmer, Mar 9, 2015.

  1. Narmer

    Narmer

    Joined:
    Mar 5, 2014
    Posts:
    25
    Code (CSharp):
    1. WWWForm form = new WWWForm ();
    2. form.AddField ("name", "value");
    3.  
    4. WWW user_get = new WWW("http://www.something.com", form);
    5.  
    6. yield return user_get;
    When I check on server side, no POST data arrive.

    It stopped working just with version 5.
     
  2. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Generate a trivially small script, and submit it as a bug. The QA team can then investigate.
     
  3. moljerc

    moljerc

    Joined:
    Mar 6, 2015
    Posts:
    12
    It didn't work When I has downloaded a assetbundle by using www .
     
  4. Narmer

    Narmer

    Joined:
    Mar 5, 2014
    Posts:
    25
  5. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    I just took a look at your script code, made minor changes and it works. I sent my version back to you.
     
  6. Narmer

    Narmer

    Joined:
    Mar 5, 2014
    Posts:
    25
  7. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Hmm. Thought it worked, but now it doesn't. :-(

    If I do:

    Code (csharp):
    1.  
    2.     IEnumerator Start () {
    3.         WWWForm form = new WWWForm ();
    4.         form.AddField ("name", "value");
    5.         form.AddField ("name2", "value2");
    6.        
    7.         WWW user_get = new WWW("http://54.76.229.0/post.php", form);
    8.        
    9.         yield return user_get;
    10.  
    11.         if(!string.IsNullOrEmpty(user_get.error)){
    12.             gt.text = "Error: " + user_get.error;
    13.         } else {
    14.                 Debug.Log (user_get.text);
    15.         }
    16.     }
    17.  
    and use this as post.php:

    Code (csharp):
    1.  
    2. <?phpvar_dump($_REQUEST); ?>
    3.  
    Then it looks like the first field is wired up to the POST request, which does look like a bug. I've told the web player develop to take a look.
     
  8. Narmer

    Narmer

    Joined:
    Mar 5, 2014
    Posts:
    25
    Thank you. It makes my game disfunctional.

     
  9. sk8terboy4

    sk8terboy4

    Joined:
    Mar 29, 2013
    Posts:
    29
    Any Fix on this?
     
  10. david_n

    david_n

    Joined:
    Feb 12, 2015
    Posts:
    3
    Last edited: Apr 1, 2015
  11. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Seems to be a bug. R&D tell me that 5.1 will have a fix.
     
  12. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,073
    It should be fixed with the 5.0.2 build whenever it is released.
     
  13. Reza-AUS

    Reza-AUS

    Joined:
    Aug 19, 2014
    Posts:
    6
    Hi All, is there still a bog with WWWForm, POST? I know you have mentioned WebPlayer above but I can't make it work with WebGL. It works perfectly when I'm using Safari but not at all when using Firefox or Chrome. its only when I POST a variable (short string) from Unity to the the web (a PHP page) that POST is not working.

    I have tested with the latest version (5.1.1p2) and its still not working.

    Just want to know if its a known bug? if it is, is there a temporary workaround?

    Thanks in advance!