Scripting API

UnityWebRequest

class in UnityEngine.Networking · UnityEngine.UnityWebRequestModule

45 of 49 of Unity's membersUnity's documentation
In Tassix

An HTTP(S) or file:// request. SendWebRequest starts it on a background thread; it completes at the start of a later frame (where Unity's UnityWebRequestUpdate runs), and its results read from then.

Constructors 1

UnityWebRequest()
UnityWebRequest(string url)
UnityWebRequest(Uri uri)
UnityWebRequest(string url, string method)
UnityWebRequest(Uri uri, string method)
UnityWebRequest(string url, string method, DownloadHandler? downloadHandler, UploadHandler? uploadHandler)
UnityWebRequest(Uri uri, string method, DownloadHandler? downloadHandler, UploadHandler? uploadHandler)

Fields 6

const string kHttpVerbCREATE
const string kHttpVerbDELETE
const string kHttpVerbGET
const string kHttpVerbHEAD
const string kHttpVerbPOST
const string kHttpVerbPUT

Properties 23

CertificateHandler? certificateHandler { get; set; }
bool chunkedTransfer { get; set; }
bool disposeCertificateHandlerOnDispose { get; set; }
bool disposeDownloadHandlerOnDispose { get; set; }
bool disposeUploadHandlerOnDispose { get; set; }
DownloadHandler? downloadHandler { get; set; }
float downloadProgress { get; }
ulong downloadedBytes { get; }
string? error { get; }
bool isDone { get; }
bool isHttpError { get; }
bool isNetworkError { get; }
string method { get; set; }
int redirectLimit { get; set; }
long responseCode { get; }
Result result { get; }
int timeout { get; set; }

Seconds before the request gives up; 0 means no limit.

UploadHandler? uploadHandler { get; set; }
float uploadProgress { get; }
ulong uploadedBytes { get; }
Uri? uri { get; set; }
string url { get; set; }
bool useHttpContinue { get; set; }

Methods 19

void Abort()
static void ClearCookieCache()
static void ClearCookieCache(Uri uri)
static UnityWebRequest Delete(string uri)
static UnityWebRequest Delete(Uri uri)
void Dispose()
static string EscapeURL(string s)
static string EscapeURL(string s, Encoding e)

Unity's URL escaping: letters, digits and "-_." stay, spaces become '+', the rest %xx in lowercase hex.

static byte[] GenerateBoundary()
static UnityWebRequest Get(string uri)
static UnityWebRequest Get(Uri uri)
string? GetRequestHeader(string name)
string? GetResponseHeader(string name)
Dictionary<string, string>? GetResponseHeaders()
static UnityWebRequest Head(string uri)
static UnityWebRequest Head(Uri uri)
static UnityWebRequest Post(string uri, string postData, string contentType)
static UnityWebRequest Post(Uri uri, string postData, string contentType)
static UnityWebRequest Post(string uri, string postData)
static UnityWebRequest Post(Uri uri, string postData)
static UnityWebRequest Post(string uri, WWWForm formData)
static UnityWebRequest Post(Uri uri, WWWForm formData)
static UnityWebRequest Post(string uri, Dictionary<string, string> formFields)
static UnityWebRequest Post(Uri uri, Dictionary<string, string> formFields)

Unity 2022+'s Post: the body as given, with the content type given.

The form-encoded Post (the body escaped as a form value).

static UnityWebRequest PostWwwForm(string uri, string form)
static UnityWebRequest PostWwwForm(Uri uri, string form)
static UnityWebRequest Put(string uri, byte[] bodyData)
static UnityWebRequest Put(Uri uri, byte[] bodyData)
static UnityWebRequest Put(string uri, string bodyData)
static UnityWebRequest Put(Uri uri, string bodyData)
static byte[] SerializeSimpleForm(Dictionary<string, string> formFields)
void SetRequestHeader(string name, string value)
static string UnEscapeURL(string s)
static string UnEscapeURL(string s, Encoding e)

Not in Tassix yet 4

Finalize SerializeFormSections httpForcedVersion isModifiable

Checked against Unity

Conformance scenarios that exercise it, recorded in Unity and compared event by event.