1.3 KiB
1.3 KiB
1. Dispatcher Foundation
- 1.1 Add a
MainThreadNetworkDispatcherinAssets/Scripts/Network/NetworkApplication/that stores queued network work items in a thread-safe FIFO structure. - 1.2 Define the dispatcher API needed by runtime code, including enqueueing from transport callbacks and draining from the Unity main thread.
2. Message Pipeline Refactor
- 2.1 Refactor
MessageManagersoITransport.OnReceiveparses envelopes and enqueues dispatch work instead of invoking registered handlers inline. - 2.2 Preserve current handler registration and invalid-payload handling while moving actual handler execution into the dispatcher drain path.
3. Unity Runtime Integration
- 3.1 Integrate the dispatcher into
Assets/Scripts/NetworkManager.csso queued network messages are drained from the Unity frame loop. - 3.2 Ensure transport-side responsibilities remain limited to receive, KCP processing, and enqueue/error handling, with Unity object mutation occurring only after main-thread drain.
4. Verification
- 4.1 Add or update edit mode tests to verify receive callbacks defer handler execution until an explicit drain step and preserve FIFO ordering.
- 4.2 Run the relevant network edit mode tests/build and update
CodeX-TODO.mdto reflect stage four progress once the implementation is complete.