com.unity.netcode 1.5.0

com.unity.netcode

Source docs
Notes: processedReleased April 23, 2025

Browse versions

PreviousNext

Unity Compatibility

Minimum Unity: 2022.3 (20f1)

Package Dependencies

Features

  • The `AutomaticThinClientWorldsUtility` class, which facilitates runtime creation (and management) of thin clients. It is available to user-code, and when in `PlayType.Server`.
  • `ClientTickRate.NumAdditionalClientPredictedGhostLifetimeTicks`, which can be used to fine-tune/alleviate a common issue where **correctly predicted** client predicted spawns are de-spawned by the netcode package **before** they have an opportunity to be classified against their server-side counterparts, which is a common occurrence when said spawns replicate later than expected (which can happen for a variety of reasons). The default behaviour is to have them despawn if they have not been classified by the `NetworkTime.InterpolationTick`. This value extends this threshold by this many additional ticks. However, if ghosts are frequently unable to replicate by the `NetworkTime.InterpolationTick`, then your interpolation buffer may be too small. I.e. Consider tweaking `ClientTickRate.InterpolationTimeMS` (or the `InterpolationTimeNetTicks` equivalent) first. For further reading, refer to the [interpolation docs here](Documentation~/interpolation.md).
  • Exposed the `k_TickPeriod` range constant (defaulting to `±5 ticks`) in the default classification system as `ClientTickRate.DefaultClassificationAllowableTickPeriod`. This may help fix esoteric default classification related errors, particularly when the server is frequently batching ticks (leading to large tick deltas). That said; prefer writing your own classification system, which can take advantage of project-specific `GhostField` data to more accurately classify predicted spawns.
  • `ClientServerBootstrap.AllNetCodeWorldsEnumerator` and `ClientServerBootstrap.AllClientWorldsEnumerator` helpers.
  • Doc on gotcha with custom template serialization and byte alignment.
  • Tests (and a packet dump entry & warning log) covering the case where clients are impacted by the unfathomably rare `MaxBaselineAge` edge-case.
  • FixedList replication support for RPC, Command, and components (IComponentData, IBufferElementData, IInputComponentData). Some limitation apply, see the doc for further info.
  • unsafe fixed buffer replication support for RPC, Command, and components (IComponentData, IBufferElementData, IInputComponentData). Some limitation apply, see the doc for further info.
  • GhostAuthoringComponent.UseSingleBaseline\`, denoting that this prefab type should force 'single baseline' delta-compression during serialization, which can lead to significant CPU savings at the cost of marginally increased bandwidth consumption, particularly for ghosts with many components, and/or with many GhostField's which rarely change.
  • new templates for serializing bytes and short using 8 and 16 bits instead of a full 32 bit data, when they are sent uncompressed.
  • Static-optimized ghosts now report their `CanUseStaticOptimization` (CUSO) status to the packet dump (including the `ComponentType` of the first detected changed version), which should aid debugging efforts.
  • Broad packet dump data improvements, at the cost of worsened server performance when enabled.
  • missing documentation in regards what are the fields types for which prediction errors are reported.
  • Documentation and test coverage regarding the `GhostGroup` feature.
  • Test and doc coverage of `[GhostField]` C# unions (via `[StructLayout(LayoutKind.Explicit)]`), which are supported (with many caveats).
  • Test coverage of `NetworkStreamSnapshotTargetSize`, UTP's `MaxMessageSize`, and `GhostSystemConstants.MaxSnapshotSendAttempts`.

📈 Improvements

  • **Behaviour Breaking Change:** The client will now ignore the `HandshakeApprovalTimeoutMS` until it has completed the `Handshake` phase, as it should respect this servers value, rather than assuming its own. Relatedly: Be aware that client worlds will not fetch the `ClientServerTickRate` values from a `NetCodeConfig.Global` config, they will only accept values sent to it by the server during handshake.
  • **Behaviour Breaking Change:** The `AddCommandData` method will now reject inputs with `Invalid` Tick v