Netcode Bootstrap

This commit is contained in:
Luis Gonzalez
2026-05-31 14:27:52 -07:00
parent 99d8d2d2a9
commit 7fa77ce821
1813 changed files with 2921554 additions and 84 deletions
@@ -0,0 +1,101 @@
> 🛑 **DO NOT FILE — WITHDRAWN 2026-05-31.** This was **not** an engine bug. A clean, fresh Unity `6000.6.0a6` project (`../Local Reference`, a full Netcode-for-Entities framework) runs netcode fine on the same alpha. The failure was specific to Project M's environment (in-place 6.4→6.6 upgrade + embedded Entities-1.x `com.rukhanka.animation` package + default driver/AutoConnect path). See `Docs/Vault` DR-002 → "Correction". Kept only as a record of the investigation.
# Unity Bug Report — Netcode for Entities / Unity Transport (6000.6.0a6)
> Copy-paste into the Unity Bug Reporter (Help ▸ Report a Bug) or the Unity Discussions/issue tracker.
> Captured 2026-05-30 from Project M. Background: [[DR-002_Unity66_Alpha_Netcode_Transport]].
**Title:** [Netcode for Entities] In-editor client↔server connection never establishes — Unity Transport throws `Trying to access an invalid wrapped network interface` every frame (6000.6.0a6)
**Package(s):** Netcode for Entities `com.unity.netcode` 6.6.0 · Unity Transport `com.unity.transport` 6.6.0
**Severity:** Blocker — no Netcode-for-Entities connection can be established in the Editor; networked play is unusable.
**Unity version:** 6000.6.0a6
**Re-resolved package versions on this editor:**
- `com.unity.netcode` 6.6.0
- `com.unity.transport` 6.6.0
- `com.unity.entities` / `com.unity.collections` / `com.unity.entities.graphics` 6.5.0
- `com.unity.physics` 6.5.0
- `com.unity.burst` 1.8.29 · `com.unity.mathematics` 1.4.0
**Environment:** macOS (Apple Silicon), `OSXEditor`, URP 17.6. In-Editor (not batch mode).
---
## Description
Any standard Netcode-for-Entities setup that creates a `ServerWorld` + `ClientWorld` and auto-connects (the default `ClientServerBootstrap` with `AutoConnectPort` set, `RequestedPlayType = ClientAndServer`) **fails to ever establish a connection in the Editor**. The client creates a `NetworkStreamConnection` entity, but the server never accepts it and **no `NetworkId` is ever assigned** to either side.
Every frame, the Console floods with:
```
Exception thrown in a managed function called from unmanaged code:
System.InvalidOperationException: Trying to access an invalid wrapped network interface.
```
When the Jobs Debugger is enabled, this is accompanied by a cascade of dependency-safety exceptions across Unity Transport's internal layered-driver jobs, e.g.:
```
InvalidOperationException: The previously scheduled job NetworkDriver:UpdateJob writes to the
Unity.Collections.NativeList`1[...]. You are trying to schedule a new job
SimpleConnectionLayer:ReceiveJob`1 / SequenceReorderingLayer:ReceiveJob / TopLayer:CompleteReceiveJob /
AnalyticsLayer:AnalyticsJob / BottomLayer:ClearJob / RpcSystem:RpcExecJob ...
To guarantee safety, you must include NetworkDriver:UpdateJob as a dependency of the newly scheduled job.
```
and subsequently:
```
[Netcode] Server Tick Batching has occurred due to the server falling behind its desired SimulationTickRate ...
```
**Disabling the Jobs Debugger** (`JobsUtility.JobDebuggerEnabled = false`) removes the dependency-safety exceptions, but the **`Trying to access an invalid wrapped network interface`** error persists and the connection still never forms — so the invalid network interface is the root cause, independent of the safety checks.
## Steps to reproduce (minimal — no gameplay content required)
1. New project on **6000.6.0a6**; add `com.unity.netcode` (6.6.0; Entities 6.5.0 / Transport 6.6.0 resolve automatically).
2. Add this bootstrap (the only script needed):
```csharp
using Unity.Entities;
using Unity.NetCode;
using UnityEngine.Scripting;
[Preserve]
public class TestBootstrap : ClientServerBootstrap
{
public override bool Initialize(string defaultWorldName)
{
AutoConnectPort = 7979; // in-editor auto-connect (ClientAndServer, IPC)
CreateDefaultClientServerWorlds();
return true;
}
}
```
3. Open any scene — an **empty scene** (camera + light only; no SubScene, no ghosts, no systems) is sufficient.
4. Enter Play Mode.
## Expected
The in-process client connects to the server over IPC; the server assigns a `NetworkId`; a `NetworkStreamConnection` is established on both worlds. No Transport exceptions.
## Actual
No connection forms.
- `ServerWorld`: 0 `NetworkStreamConnection`, 0 `NetworkId`.
- `ClientWorld`: 1 `NetworkStreamConnection`, **0 `NetworkId`**.
- Console floods every frame with `Trying to access an invalid wrapped network interface` (plus Transport job-safety exceptions when the Jobs Debugger is on).
## Frequency
100% reproducible. Occurs with **zero gameplay content** (empty scene + the bootstrap above), confirming it is not project-specific.
## Regression / likely cause
- Netcode for Entities + Unity Transport are transitioning to built-in Core packages (since 6000.5.0a7), which renumbered them into the 6.x editor line.
- The **6000.6.0a5** changelog states Netcode snapshots were reworked to use Unity Transport's *"unreliable sequenced pipeline"* — the same `SequenceReorderingLayer` / layered-driver path that throws here. The regression appears to coincide with that rework.
## Known-good baseline
The same setup works on **Unity 6.4.x** (Netcode for Entities 1.13.2 / Unity Transport 2.7.2).