Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


DownloadHandler

Manage and process HTTP response body data received from a remote server.
Read time 1 minuteLast updated 4 days ago

Definition

public class DownloadHandler : IDisposable

Remarks

DownloadHandler objects are helper objects. When attached to a UnityWebRequest, they define how to handle HTTP response body data received from a remote server. Generally, they are used to buffer, stream and/or process response bodies.
DownloadHandler is a base class. Depending on usage scenario, different specialized classes are available. DownloadHandlerBuffer provides basic buffering, while DownloadHandlerTexture and DownloadHandlerAssetBundle provide more efficient solutions for Texture and AssetBundle downloads.
For custom use cases, see DownloadHandlerScript.

Properties

Property

Description

dataReturns the raw bytes downloaded from the remote server, or
null
. (Read Only)
errorError message describing a failure that occurred inside the download handler.
isDoneReturns
true
if this DownloadHandler has been informed by its parent UnityWebRequest that all data has been received, and this DownloadHandler has completed any necessary post-download processing. (Read Only)
nativeDataProvides direct access to downloaded data.
textConvenience property. Returns the bytes from DownloadHandler.data interpreted as a UTF8 string. (Read Only)

Methods

Method

Description

CompleteContentCallback, invoked when all data has been received from the remote server.
DisposeSignals that this DownloadHandler is no longer being used, and should clean up any resources it is using.
GetDataCallback, invoked when the DownloadHandler.data property is accessed.
GetNativeDataProvides allocation-free access to the downloaded data as a NativeArray.
GetProgressCallback, invoked when UnityWebRequest.downloadProgress is accessed.
GetTextCallback, invoked when the DownloadHandler.text property is accessed.
ReceiveContentLengthHeaderCallback, invoked with a
Content-Length
header is received.
ReceiveDataCallback, invoked as data is received from the remote server.