UnityWebRequest is Unity’s HTTP/HTTPS networkingThe Unity system that enables multiplayer gaming across a computer network. More info See in Glossary API for communicating with web services, transferring files, and streaming data at runtime.
Common uses for the Unity web request system include:
Downloading content at runtime, such as:
AssetBundles from remote servers, when using the regular AssetBundle or Addressables systems.
Text/JSON for config, localization, and live tuning.
Images (as TexturesAn image used when rendering a GameObject, Sprite, or UI element. Textures are often applied to the surface of a mesh to give it visual detail. More info See in Glossary) and audio (as AudioClips) for dynamic content.
Build-time or runtime patching via remote manifests.
Uploading data to servers, such as:
Player metrics.
Saved game state.
Error/exception logs and crash reports.
Custom telemetry and analyticsAbbreviation of Unity Analytics See in Glossary.
Integrating with content delivery networks, authentication and security, payment platforms, multiplayer services, diagnostics, and remote build pipelines.
Implementing low-traffic, networked multiplayer and turn-based games, such as chess.
Architecture
The Unity web request system consists of two layers:
A High-Level API (HLAPI) wraps the low-level API and provides a convenient interface for common operations.
A Low-Level API (LLAPI) provides maximum flexibility for more advanced oeprations.
The system breaks down an HTTP transaction into the following operations:
Sending data to the server.
Receiving data from the server.
HTTP flow control (for example, redirects and error handling).
Each of these operations are managed by a specific type of object, which you can use to customize and control aspects of the transaction:
An UploadHandler object handles transmission of data to the server.
A DownloadHandler object handles receipt, buffering, and postprocessing of data received from the server.
A UnityWebRequest object manages the other two objects, and also handles HTTP flow control. This object is where custom headers and URLs are defined, and where error and redirect information is stored.
Data sent from user code passes through an UploadHandler and then a UnityWebRequest before reaching the HTTP web server. Data received from the server passes through a UnityWebRequest and then a DownloadHandler before reaching user code.
The following is a high level overview of a HTTP transaction: