Skip to content

About

In-editor network traffic inspector for Unity. Browse UnityWebRequest headers, payloads and responses in a DevTools-style window.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Network Activity Inspector

Unity License UPM

An in-editor network traffic inspector for Unity. Capture every UnityWebRequest your game sends, and browse the URL, headers, request payload and response body in a Chrome DevTools style window — without leaving the Editor.

English | 한국어

Features

  • Live capture — logs are appended while the game is running in Play Mode.
  • Split view — resizable request list on the left, full request/response detail on the right.
  • Pretty JSON — request payloads and responses are indented via Newtonsoft.Json.
  • Search — filter logs by URL, request payload or response body.
  • Protocol filter — flag-based filter (Http, Tcp, Everything).
  • Foldable sections — General / Request Headers / Response Headers / Request Payload / Response.
  • Scroll Lock & Clear on Stop — keep your place, or clear logs automatically when Play Mode exits.
  • Zero cost in builds — capture is compiled out outside the Editor (see Runtime behaviour).

Requirements

Item Version
Unity 2021.2 or newer (uses TwoPaneSplitView)
com.unity.nuget.newtonsoft-json 3.0.2 (resolved automatically)

Installation

Package Manager UI

  1. Open Window ▸ Package Manager.
  2. Click + ▸ Add package from git URL...
  3. Paste the URL below and press Add.
https://github.com/ez8801/NetworkActivityInspector.git

manifest.json

Add the package to Packages/manifest.json:

{
  "dependencies": {
    "com.ez.network-activity-inspector": "https://github.com/ez8801/NetworkActivityInspector.git"
  }
}

To pin a specific release, append a tag or commit hash: ...NetworkActivityInspector.git#1.0.1.

Getting Started

1. Hook up your requests

Call NetworkActivity.OnRequest with the async operation returned by SendWebRequest(). The call awaits the request for you, so use it in place of await operation.

using UnityEngine.Networking;
using EZ.Network;

public async Task<string> PostAsync(string url, string payload)
{
    var request = UnityWebRequest.Post(url, payload);
    var operation = request.SendWebRequest();

    // Awaits the operation and records the request/response pair.
    await NetworkActivity.OnRequest(operation, payload);

    return request.downloadHandler.text;
}

payload is optional — NetworkActivity.OnRequest(operation) records the request without a body.

2. Open the window

Tools ▸ Inspect Network Activity, or press Ctrl+F1 (Cmd+F1 on macOS).

3. Enter Play Mode

Requests appear in the list as they are sent. Select a row — or use ↑/↓ — to inspect it.

Toolbar Reference

Control Description
Clear Removes all captured logs.
Fold Collapses / expands every detail section at once.
Clear on Stop Clears the log list when Play Mode exits (and when the window is disabled).
Pretty Indents JSON payloads and responses.
Protocol flags Shows only logs matching the selected Protocol flags.
Search field Matches URL, request payload and response body (case sensitive).
Update When Changed Repaints the list as new logs arrive. Turn off to freeze the view.
Scroll Lock Stops the list from auto-scrolling to the newest log.

API Reference

Member Description
Task NetworkActivity.OnRequest(UnityWebRequestAsyncOperation operation) Awaits the operation and records it.
Task NetworkActivity.OnRequest(UnityWebRequestAsyncOperation operation, string arguments) Same, with the request payload recorded as arguments.
bool NetworkActivity.IsLoggable() true in the Editor, false in players.
enum Protocol Http, Tcp, Everything — used by the toolbar filter.
UnityWebRequestAsyncOperation.GetAwaiter() Extension in EZ.Network.Extensions that makes the operation awaitable.

Runtime Behaviour

NetworkActivity.IsLoggable() is guarded by #if UNITY_EDITOR, so in a player build OnRequest allocates no PacketLog and records nothing. It still returns a Task, so the caller must await the request itself in builds:

var operation = request.SendWebRequest();
await NetworkActivity.OnRequest(operation, payload); // no-op outside the Editor
while (!request.isDone)                              // ensure completion in builds
    await Task.Yield();

Limitations

  • Only UnityWebRequest traffic that you route through NetworkActivity.OnRequest is captured. There is no automatic hook.
  • Protocol.Tcp exists as a filter value, but every log is currently tagged Protocol.Http.
  • Logs live in memory only and are not persisted between Editor sessions.

Changelog

See CHANGELOG.md.

License

MIT — see LICENSE.md.

About

In-editor network traffic inspector for Unity. Browse UnityWebRequest headers, payloads and responses in a DevTools-style window.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages