Legacy Documentation: Version 2018.1 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

UnityWebRequest Constructor

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public UnityWebRequest()
public UnityWebRequest();
public UnityWebRequest(url: string)
public UnityWebRequest(string url);
public UnityWebRequest(uri: Uri)
public UnityWebRequest(Uri uri);
public UnityWebRequest(url: string, method: string)
public UnityWebRequest(string url, string method);
public UnityWebRequest(uri: Uri, method: string)
public UnityWebRequest(Uri uri, string method);
public UnityWebRequest(url: string, method: string, downloadHandler: Networking.DownloadHandler, uploadHandler: Networking.UploadHandler)
public UnityWebRequest(string url, string method, Networking.DownloadHandler downloadHandler, Networking.UploadHandler uploadHandler);
public UnityWebRequest(uri: Uri, method: string, downloadHandler: Networking.DownloadHandler, uploadHandler: Networking.UploadHandler)
public UnityWebRequest(Uri uri, string method, Networking.DownloadHandler downloadHandler, Networking.UploadHandler uploadHandler);

Parameters

urlThe target URL with which this UnityWebRequest will communicate. Also accessible via the url property.
uriThe target URI to which form data will be transmitted.
methodHTTP GET, POST, etc. methods.
downloadHandlerReplies from the server.
uploadHandlerUpload data to the server.

Description

Creates a UnityWebRequest with the default options and no attached DownloadHandler or UploadHandler. Default method is GET.

The raw constructor is useful for use cases which require detailed custom configuration of a UnityWebRequest. Most use cases will require the attachment of a DownloadHandler, an UploadHandler or both in order to function propertly.

See Also: Get, GetTexture, GetAudioClip, GetAssetBundle, Head, Post, Put, Delete.

Did you find this page useful? Please give it a rating: