LocalStagingOrigin Class

Namespace: Decnet.PatchProof.Origins
Assembly: Decnet.PatchProof.Origins.dll

The LocalStagingOrigin class embeds a high-performance HTTP web server inside Unity for serving Addressables content over loopback.


Class Definition

public class LocalStagingOrigin : IDisposable
{
    public string BindIp { get; }
    public int Port { get; }
    public string BaseUrl { get; }
    public bool IsRunning { get; }
    public FaultProfile ActiveFaultProfile { get; set; }

    public LocalStagingOrigin(string bindIp = "127.0.0.1", int port = 8899);

    public void MapRoute(string urlPrefix, string localDirectory);
    public void ClearRoutes();
    public bool Start(out string error);
    public void Stop();
    public List<HttpTrace> GetTraces();
    public void ClearTraces();
}

Example: Programmatic Staging Server

using Decnet.PatchProof.Origins;
using Decnet.PatchProof.Core;

// Initialize server on localhost port 8899
using var origin = new LocalStagingOrigin("127.0.0.1", 8899);

// Mount content directories to virtual routes
origin.MapRoute("/content/v1.0.0/", "D:/Builds/v1.0.0/ServerData");
origin.MapRoute("/content/v2.0.0/", "D:/Builds/v2.0.0/ServerData");

// Attach an active fault profile
origin.ActiveFaultProfile = new FaultProfile
{
    name = "LatencyProfile",
    enabled = true,
    rules = {
        new FaultRule {
            faultType = FaultType.LatencyDelay,
            delayMilliseconds = 1000,
            urlPattern = ".*"
        }
    }
};

// Start server
if (origin.Start(out string startError))
{
    Debug.Log($"Staging origin listening at {origin.BaseUrl}");
}

Back to top

Copyright © 2026 Decnet Games. PatchProof — Addressables Release Rehearsal Lab. Available on the Unity Asset Store (Short link: u3d.as/4g0P). Tested on Unity 6000.5.4f1 LTS with Addressables 2.9.1. All rights reserved.

This site uses Just the Docs, a documentation theme for Jekyll.