Search Unity

What's wrong with UnityWebRequest.Post()

Discussion in 'Multiplayer' started by SamTyurenkov, Dec 3, 2019.

  1. SamTyurenkov

    SamTyurenkov

    Joined:
    May 12, 2018
    Posts:
    95
    First of all VS says it doesn't have a Post type, and underlines it:



    Second thing, according to manual, you have to use method as a parameter, and you have to use download and upload handlers:
    https://docs.unity3d.com/2020.1/Documentation/ScriptReference/Networking.UnityWebRequest-ctor.html

    Third thing, all the other docs and answers around still use it as .Post().

    Can someone tell me a correct up to date alternative to that:

    Code (CSharp):
    1. UnityWebRequest www = new UnityWebRequest.Post("http://url.com", formData);
    with those download and uploadhandlers
    Code (CSharp):
    1. public UnityWebRequest(Uri uri, string method, Networking.DownloadHandler downloadHandler, Networking.UploadHandler uploadHandler);
    Thanks!
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    UnityWebRequest.Post() is a static method, don't put new before it.
     
    SamTyurenkov likes this.