Documentation

Unity Engine

Download Unity

Unity Engine

Web Requests Profiler module reference

Use the Web Requests Profiler module to inspect the HTTP requests your application sends.
Read time 9 minutesLast updated 7 hours ago

The Web Requests Profiler module displays information about the HTTP requests your application sends through
UnityWebRequest
. This includes requests that
System.Net.Http.HttpClient
sends when it uses
UnityHttpMessageHandler
as its message handler. The module doesn't record requests that
HttpClient
sends through any other message handler. The module charts how many requests are in flight and how many bytes they send and receive each frame. It also lists every request in the capture with its status, size, and duration. Use this module to find slow or failing requests, check what your application sends to a server, and check what the server sends back.
This module is active by default. To show or hide it, refer to Activating Profiler modules. The module records a request only if the Profiler is recording when the request starts. Unity records the details of each request, such as its headers, bodies, and timings, when the request finishes. If you stop recording or deactivate the module while a request is in flight, the request list still displays the request, but as an incomplete request without its details.
Important
Profiler captures can contain credentials and personal data from the requests your application sends and receives. For more information, refer to Safeguard sensitive data.

Chart categories

The upper half of the Profiler window displays a Web Requests chart with the following categories:

Chart

Description

Active RequestsThe number of requests in flight during this frame.
Bytes DownThe number of bytes your application received from requests during this frame.
Bytes UpThe number of bytes your application sent in requests during this frame.
The module also registers the Requests Started, Requests Completed, Requests Failed, and Requests Dropped counters in the Web Requests Profiler category. The chart doesn't display these counters, but you can read them from a script with
ProfilerRecorder
while the module is active.

Module details pane toolbar

When you select the Web Requests module, the module details pane displays the requests that Unity recorded during the capture. Use the toolbar to access the following functionality:

Property

Description

Search fieldFilters the request list by URL, method, status code, content type, or request source.
Details panel toggleShows or hides the details panel for the selected request.

Summary bar

The summary bar displays totals for all requests in the capture. Filtering the request list doesn't change these totals. The summary bar contains the following items:

Property

Description

RequestsThe number of requests in the capture. When you filter the list, the item displays the number of visible requests out of the total. If the Profiler doesn't record some requests, the item also displays the number of dropped requests. For more information, refer to Request limits.
CompletedThe number of requests that finished.
TransferredThe total number of bytes sent and received. If some requests ran on a platform that doesn't count transferred bytes, the value starts with ≥ to indicate that it's a lower bound.
Pending RequestsThe number of requests still in flight.
Latency p95The duration within which 95% of the finished requests complete. This value doesn't include requests that are still in flight.
ErrorsThe number of requests that failed or that finished with an HTTP status code of 400 or higher.
Total Bytes Down/UpThe total number of bytes received and sent, as separate values.

Request list

The request list displays one row for each request in the capture, in the order the requests started. To sort the list, select a column header. To sort by more than one column, hold Shift and select additional column headers.
When you select a request, the Profiler window jumps to the frame in which that request finished. The details panel, on the right side of the module details pane, displays information about the selected request.
The request list contains the following columns:

Column

Description

# The order in which the requests started.
StatusThe HTTP status code of the response. The column displays ... while the request is in flight, and - if the request finished without a status code. The color of the status code indicates whether the request succeeded, finished with a warning, or failed. Hover over the status code to display its description.
MethodThe HTTP method of the request, such as
GET
or
POST
.
Name/Target DomainThe URL of the request. A warning icon appears next to URLs that use plain HTTP to a server other than the local machine, to indicate that Unity doesn't encrypt the request or the response.
Request SourceThe API that sent the request: UnityWebRequest, or .NET HttpClient for requests that
HttpClient
sends through
UnityHttpMessageHandler
.
TypeThe content type of the response.
SizeThe number of bytes received. The column displays — if the platform doesn't count transferred bytes.
DurationThe time from the start of the request until it finished.

Context menu

Right-click (macOS: Ctrl+click) a request to open a menu with the following options:

Option

Description

Copy URLCopies the URL of the request to the clipboard.
Copy DetailsCopies a summary of the request to the clipboard, including its method, URL, status, source, content type, transferred bytes, and duration.

Details panel

The details panel displays information about the selected request in the following tabs:
Unity records request and response bodies only if their content type is text, such as
text/*
, JSON, XML, JavaScript, or URL-encoded form data (
application/x-www-form-urlencoded
). Unity records up to 16 KB of each body. If a body is longer, the Payload and Response body tabs display the size of the recorded part and the size of the full body. If Unity doesn't record a body, the tab explains why.
If a body has a JSON content type, the tab displays it as an expandable tree. The Payload and Response body tabs have the following buttons:

Button

Description

View SourceDisplays the raw text of the query string or body. Select View Parsed to return to the tree or parameter list.
CopyCopies the raw text of the query string or body to the clipboard.

Headers tab

The Headers tab contains the following sections:

Section

Description

GeneralThe Request URL, Request Method, Status Code, Request Source, Content Type, Transferred bytes, and Duration of the request.
Response HeadersThe headers the server sent in its response.
Request Headers (Configured)The headers your code set on the request.
Request Headers (Wire)The headers that Unity sent to the server, including headers that Unity adds itself, such as a generated
User-Agent
header and cookies. Not all platforms support this section, and the section is empty if the request fails before Unity sends it.
A warning icon appears next to headers whose values are credentials. For more information, refer to Safeguard sensitive data.

Payload tab

The Payload tab appears only when the request has a query string or a request body. It contains the following sections:

Section

Description

Query String ParametersThe name and value of each parameter in the query string of the URL.
Request PayloadThe body your application sent with the request.

Response body tab

The Response body tab displays the body that the server sent in its response.

Timing tab

The Timing tab displays how long each phase of the request took, in milliseconds, as a waterfall chart. If a phase doesn't occur, the tab displays Skipped for that phase. For example, a plain HTTP connection has no Transport Layer Security (TLS) handshake, and a reused connection has no Domain Name System (DNS) lookup. Not all platforms measure the duration of each phase. If the platform doesn't measure phase durations, the tab displays a message instead.
The Timing tab contains the following phases:

Phase

Description

QueueingThe time the request waited before the transfer started.
DNS LookupThe time taken to resolve the host name of the server.
Initial ConnectionThe time taken to open a connection to the server.
TLSThe time taken to complete the TLS handshake for a secure connection.
Request sentThe time taken to prepare and send the request.
Waiting for server responseThe time between sending the request and receiving the first byte of the response.
Content DownloadThe time taken to receive the rest of the response.
Total TimeThe total duration of the request.

Request limits

The Profiler tracks up to 1,024 requests in flight at the same time. If your application starts more requests while 1,024 are in flight, the Profiler doesn't record them. The Requests item in the summary bar displays the number of dropped requests.
The request list displays up to 2,048 requests. When a capture contains more requests, the list removes the oldest ones, but the summary bar still includes them in its totals.

Safeguard sensitive data

The Web Requests module records the requests your application sends and the responses it receives. This data can include sensitive information, such as passwords, access tokens, and personal data. Unity stores this data in plain text in the Profiler capture, and anyone who has a copy of a saved capture can read it.
Unity records request data only in the Unity Editor and in Development builds, while the Profiler is recording and the Web Requests module is active. A capture can contain the following data for each request:
  • The full URL, including the query string. Some web services expect API keys or access tokens in the query string.
  • The request headers your code sets, the request headers Unity sends, and the response headers. These can include
    Authorization
    headers and cookies.
  • Up to 16 KB of each text request body and response body. For example, the body of a login request can contain a user name and password, and the body of its response can contain an access token.
The module displays a warning icon next to the
Authorization
,
Proxy-Authorization
,
Cookie
, and
Set-Cookie
headers. The module doesn't detect sensitive data anywhere else, such as in custom headers, query strings, or bodies. A request without a warning icon can still contain sensitive data.
To reduce the risk of exposing sensitive data:
  • Deactivate the Web Requests module when you don't need it, and always before you record a capture to share with others. For more information, refer to Activating Profiler modules.
  • Use test accounts, test credentials, and test servers when you profile your application.
  • Treat any capture you record while the Web Requests module is active as sensitive. Don't attach it to bug reports or post it in public forums unless you know it contains no real credentials or personal data.
  • Exclude the
    ProfilerCaptures
    folder from version control, or change the save location in Profiler Preferences. By default, Unity saves captures to the
    ProfilerCaptures
    folder of your project, so anyone with access to your project can open them.

Additional resources