{"id":28936277,"url":"https://github.com/hexdogstudio/mock-cdn-unity","last_synced_at":"2026-05-06T10:32:30.553Z","repository":{"id":300227600,"uuid":"1005474290","full_name":"hexdogstudio/mock-cdn-unity","owner":"hexdogstudio","description":"Mock Content Delivery Network for Unity to test remote Addressable Bundle delivery.","archived":false,"fork":false,"pushed_at":"2025-06-20T13:47:31.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-20T14:39:37.061Z","etag":null,"topics":["cdn","express","mock-server","testing-tools","unity","unity-addressables"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hexdogstudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-20T09:32:27.000Z","updated_at":"2025-06-20T13:48:45.000Z","dependencies_parsed_at":"2025-06-20T14:39:39.204Z","dependency_job_id":"df9f44f8-cdc6-4606-9941-8760c3b8a9bf","html_url":"https://github.com/hexdogstudio/mock-cdn-unity","commit_stats":null,"previous_names":["hexdogstudio/mock-cdn-unity"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hexdogstudio/mock-cdn-unity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdogstudio%2Fmock-cdn-unity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdogstudio%2Fmock-cdn-unity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdogstudio%2Fmock-cdn-unity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdogstudio%2Fmock-cdn-unity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hexdogstudio","download_url":"https://codeload.github.com/hexdogstudio/mock-cdn-unity/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexdogstudio%2Fmock-cdn-unity/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261358697,"owners_count":23146674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cdn","express","mock-server","testing-tools","unity","unity-addressables"],"created_at":"2025-06-22T20:08:13.976Z","updated_at":"2026-05-06T10:32:30.541Z","avatar_url":"https://github.com/hexdogstudio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mock CDN | Unity\nA lightweight mock CDN server for simulating Unity Addressables loading from a remote URL — with optional **latency** and **failure rate** injection to mimic production environments.\n\n---\n\n## 📦 Features\n\n- ✅ Serves Addressables content from a local folder\n- 🕒 Adds artificial **latency** to simulate real-world download times\n- ❌ Random **failures** to test Addressables error handling\n- 🔧 Fully configurable via `.env`\n\n---\n\n\u003e [!NOTE]\n\u003e This server is not meant for \u003cb\u003eproduction\u003c/b\u003e, only for \u003cb\u003elocal/dev\u003c/b\u003e simulation.\n\n## 🚀 Setup Instructions\n\n### 0. 📥 Install Node.js\nDownload and install Node.js from the official website:\u003cbr\u003e\n👉 https://nodejs.org/en/download\n\u003e ⚠️ Make sure to install the LTS version unless you have a specific reason to use the latest.\n\nYou can verify the installation with:\n```bash\nnode -v \u0026\u0026 npm -v\n```\n\n### 1. 📁 Clone this repository\n\n```bash\ngit clone https://github.com/hexdogstudio/mock-cdn-unity.git\n```\n### 2. 📦 Enter project folder and install dependencies\n```bash\ncd mock-cdn-unity/src/ \u0026\u0026 npm install\n```\n\n### 3. 🛠️ Configure `.env`\nAdjust the values:\n```env\nPORT=1234\nFAILUR_RATE=0.2\nMIN_LATENCY=200\nMAX_LATENCY=1500\nRESOURCE_DIR=ServerData\nVERBOSE=true\n```\n| Variable       | Description                                |\n| -------------- | ------------------------------------------ |\n| `PORT`         | Port the server listens on                 |\n| `FAILUR_RATE`  | Chance of a request failing (0.0–1.0)      |\n| `MIN_LATENCY`  | Minimum latency in milliseconds            |\n| `MAX_LATENCY`  | Maximum latency in milliseconds            |\n| `RESOURCE_DIR` | Path to your Addressables `ServerData` dir (advisable leave it as it) |\n|`VERBOSE`| Enables detailed logs (file scanning, request info, etc.) |\n\n### 4. 📦 Build Addressables in Unity\n1. In Unity, open \u003cb\u003eAddressables Groups\u003c/b\u003e window.\n2. Set your group's:\n     - Build Path to:\n       ```arduino\n       ServerData/[BuildTarget]\n       ```\n     - Load Path to (use the same port as defined by the `.env`):\n       ```arduino\n       http://localhost:1234/[BuildTarget]\n       ```\n3. Build with: `Addressables` \u003e `Build` \u003e `New Build` \u003e `Default Build Script`\n4. This will produce the following directory inside your Unity project: `ServerData/StandaloneWindows64`, or similar standalone folder depending on your target build platform.\n5. Copy the `ServerData/` directory to the \u003cb\u003eMock CDN's\u003c/b\u003e `src/` directory, now the server can finally deliver your Asset Bundles.\n\n\u003e[!IMPORTANT]\n\u003e The limitation of this solution is you have to manually copy the `ServerData/` to the `src/` directory every time you made a new build, since the `RemoteBuildPath` must be a physical folder on the disk.\u003cbr\u003e\n\u003e Alternativelly you can provide the absolute path of your \u003cb\u003eMock CDN Server\u003c/b\u003e as the `RemoteBuildPath`, for example on linux:\u003cbr\u003e `/home/user/servers/mock-cdn-unity/ServerData/[BuildTarget]`\n\n### 5. ▶️ Run the mock server\n```bash\nnpm start\n```\n\u003e You'll see output like:\n```blame\n[INIT] Checking resource directory: ServerData\n[SCEN] Searching for Asset Bundles...\n[FOUND] Asset Bundle at: ServerData/StandaloneLinux64/example.bundle\n[OK] Asset Bundle found. Starting server...\n[READY] Mock CDN running at http://localhost:1234\n```\n\n### 6. 🎮 Use Built Content in Play Mode\n\nTo make Unity load assets from the **Mock CDN** instead of the editor's **Asset Database**, do the following:\n\n1. Open the **Addressables Groups** window:  \n   `Window \u003e Asset Management \u003e Addressables \u003e Groups`\n2. In the top-right corner, find the `Play Mode Script` dropdown.\n3. Select: `Use Existing Build`\n   \n✅ Unity will now load remote-marked assets directly from your **Mock CDN server**, simulating how it will behave in a real build — including any simulated latency or failures.\n\u003e [!NOTE]\n\u003e Unity will cache remote bundles to minimize external calls, so each bundle is typically fetched only once.  \n\u003e You can bypass this by calling `Caching.ClearCache()` explicitly **before** loading your assets.  \n\u003e ⚠️ Only use this for testing purposes — clearing the cache at runtime is not recommended in production.\n\n## License\n- [MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexdogstudio%2Fmock-cdn-unity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexdogstudio%2Fmock-cdn-unity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexdogstudio%2Fmock-cdn-unity/lists"}