Skip to content

Commit

Permalink
com.unity.netcode@1.0.8
Browse files Browse the repository at this point in the history
## [1.0.8] - 2023-04-17

### Changed

* Reduced the amount of memory allocated by allocating based on the maximum number of worker threads the running platform requires rather than defaulting to using a theoretical upper-bound of 128 worker threads.
* Removed the additional entity created for each predicted ghost prefab, that was necessary to support predicted spawning. This has the addition benefit to cut almost in half (in case all ghost prefabs support all modes) the number of required archetypes.

### Fixed

* An issue with pre-spawned ghost not working correctly because sub-scene hash is calculated differently for client and server
* an issue when sub-scene are opened for live-conversion and baking, causing spawned ghosts to contains invalid blob asset references (i.e colliders), introducing potential crashes and other problems (i.e missing collision and mis-prediction)
* An issue with baking, not using the correct NetCodeClientTarget (either client or client/server) when baking a sub-scene for a client standalone build.
* An issue with the Entities/Build project settings UI that was not updating the ClientTarget to use is the ProjectSettings window was not closed, or another settings "tab" was selected.
* An issue with HasServerWorld reporting the presence of a server world even though no server was created.if it's not needed.
* A sporadic InvalidOperationException: GetSingleton<Unity.NetCode.LowLevel.SnapshotDataLookupCache>() thrown when retrieving the Unity.NetCode.LowLevel.SnapshotDataLookupCache.
* GhostCollectionSystem InvalidOperationException thrown when Ghost prefab validation fails, trying accessing invalidated DynamicBuffer.
* An issue in the GhostChunkSerializer, that was overwriting the snapshot data with some enable bits masks.
* An issue in the GhostUpdateSystem, that was reading and applying the wrong enable bits.
* An issue when restoring enable bits state from the predicted ghost history buffer.
* Fixed a "System Creation Order" bug causing components with `[GhostField]` fields (or the `[GhostEnableBit]` attribute) to silently default to the `DontSerializeVariant`, especially in cases where Ghost Prefabs are created at runtime (via `GhostPrefabCreation.ConvertToGhostPrefab`).
  * "Ghost Registration" and "Default Variant Registration" Systems now use `[CreateBefore(typeof(DefaultVariantSystemGroup))]`, so that user-code can add `[CreateAfter(typeof(DefaultVariantSystemGroup))]` when accessing `GhostComponentSerializerCollectionData` data.
  * We now also guard all of these calls, giving explicit (fatal) errors if used improperly.
* An issue in `GhostDistancePartitioningSystem`, which caused Netcode to add a shared component ECB entry for every single ghost containing a `LocalTransform`, every single frame, when `GhostDistanceImportance` was enabled in a users project.

### Deprecated

* Now that the `GhostAuthoringInspectionComponent` shows all replicated components, you shouldn't have to opt-into prefab overrides. Thus, deprecated the `SupportsPrefabOverrides` attribute.

## [1.0.0-pre.66] - 2023-03-21

### Added

* Validate and sanitise connect and listen addresses when using IPCNetworkInterface. That was causing some nasty crash in the Transport without users understanding the actual problem.

### Changed

* The following components have been renamed:
NetworkSnapshotAckComponent: NetworkSnapshotAck,
IncomingSnapshotDataStreamBufferComponent: IncomingSnapshotDataStreamBuffer,
IncomingRpcDataStreamBufferComponent: IncomingRpcDataStreamBuffer,
OutgoingRpcDataStreamBufferComponent: OutgoingRpcDataStreamBuffer,
IncomingCommandDataStreamBufferComponent: IncomingCommandDataStreamBuffer,
OutgoingCommandDataStreamBufferComponent: OutgoingCommandDataStreamBuffer,
NetworkIdComponent: NetworkId,
CommandTargetComponent: CommandTarget,
GhostComponent: GhostInstance,
GhostChildEntityComponent: GhostChildEntity,
GhostOwnerComponent: GhostOwner,
PredictedGhostComponent: PredictedGhost,
GhostTypeComponent: GhostType,
SharedGhostTypeComponent: GhostTypePartition,
GhostCleanupComponent: GhostCleanup,
GhostPrefabMetaDataComponent: GhostPrefabMetaData,
PredictedGhostSpawnRequestComponent: PredictedGhostSpawnRequest,
PendingSpawnPlaceholderComponent: PendingSpawnPlaceholder,
ReceiveRpcCommandRequestComponent: ReceiveRpcCommandRequest,
SendRpcCommandRequestComponent: SendRpcCommandRequest,
MetricsMonitorComponent: MetricsMonitor,

### Removed

* internal ListenAsync/ConnectAsync methods (no visible API changes for users)

### Fixed

* a very unfrequent exception thrown in presence of a ghost with a replicated component that does not present any prediction errors names (i.e an Entity reference).
* source generator crash when logging missing assembly dependency.
* source generator requiring Unity.Transport package dependency for generating serialization code.
* Snapshot history buffer not restore correctly, causing entities component to be stomped with random data.
* Fixed an issue when ClientServerBootstrap.AutoConnectPort is 0 indicating autoconnecting should be disabled and you will connect manually via the driver connect API, but the playmode tools ip/port fields would still triggering (so you get two connections set up and errors). We also now prevent attempts to make a connection while one is already established.
* an issue with source generator, validating incorrectly custom templates that uses overrides.
* removed warning for old temp allocation when converting sub-scene with pre-spawned ghosts.
* Forced all `ICommandData`'s `InternalBufferCapacity` to be zero, because we were constantly wasting hundreds of bytes per entity to store data that we know for certain will not fit into the internal capacity (as the dynamic buffer required length is hardcoded to 64, for netcode input buffers).
* Fixed potential crash in players when send queue is full
* Fixed exceptions when trying to use invalid interpolation ticks (could happen during snapshot updates or in predicted spawning system on disconnection)
  • Loading branch information
Unity Technologies committed Apr 17, 2023
1 parent 35d83c0 commit 916c73e
Show file tree
Hide file tree
Showing 79 changed files with 1,351 additions and 943 deletions.
4 changes: 0 additions & 4 deletions .buginfo

This file was deleted.

1 change: 0 additions & 1 deletion .footignore

This file was deleted.

102 changes: 98 additions & 4 deletions CHANGELOG.md
@@ -1,18 +1,70 @@
# Changelog

## [1.0.0-pre.65] - 2023-03-21
## [1.0.8] - 2023-04-17

### Changed

* Reduced the amount of memory allocated by allocating based on the maximum number of worker threads the running platform requires rather than defaulting to using a theoretical upper-bound of 128 worker threads.
* Removed the additional entity created for each predicted ghost prefab, that was necessary to support predicted spawning. This has the addition benefit to cut almost in half (in case all ghost prefabs support all modes) the number of required archetypes.


### Fixed

* An issue with pre-spawned ghost not working correctly because sub-scene hash is calculated differently for client and server
* an issue when sub-scene are opened for live-conversion and baking, causing spawned ghosts to contains invalid blob asset references (i.e colliders), introducing potential crashes and other problems (i.e missing collision and mis-prediction)
* An issue with baking, not using the correct NetCodeClientTarget (either client or client/server) when baking a sub-scene for a client standalone build.
* An issue with the Entities/Build project settings UI that was not updating the ClientTarget to use is the ProjectSettings window was not closed, or another settings "tab" was selected.
* An issue with HasServerWorld reporting the presence of a server world even though no server was created.if it's not needed.
* A sporadic InvalidOperationException: GetSingleton<Unity.NetCode.LowLevel.SnapshotDataLookupCache>() thrown when retrieving the Unity.NetCode.LowLevel.SnapshotDataLookupCache.
* GhostCollectionSystem InvalidOperationException thrown when Ghost prefab validation fails, trying accessing invalidated DynamicBuffer.
* An issue in the GhostChunkSerializer, that was overwriting the snapshot data with some enable bits masks.
* An issue in the GhostUpdateSystem, that was reading and applying the wrong enable bits.
* An issue when restoring enable bits state from the predicted ghost history buffer.
* Fixed a "System Creation Order" bug causing components with `[GhostField]` fields (or the `[GhostEnableBit]` attribute) to silently default to the `DontSerializeVariant`, especially in cases where Ghost Prefabs are created at runtime (via `GhostPrefabCreation.ConvertToGhostPrefab`).
* "Ghost Registration" and "Default Variant Registration" Systems now use `[CreateBefore(typeof(DefaultVariantSystemGroup))]`, so that user-code can add `[CreateAfter(typeof(DefaultVariantSystemGroup))]` when accessing `GhostComponentSerializerCollectionData` data.
* We now also guard all of these calls, giving explicit (fatal) errors if used improperly.
* An issue in `GhostDistancePartitioningSystem`, which caused Netcode to add a shared component ECB entry for every single ghost containing a `LocalTransform`, every single frame, when `GhostDistanceImportance` was enabled in a users project.


### Deprecated

* Now that the `GhostAuthoringInspectionComponent` shows all replicated components, you shouldn't have to opt-into prefab overrides. Thus, deprecated the `SupportsPrefabOverrides` attribute.


## [1.0.0-pre.66] - 2023-03-21

### Added

* validate and sanitise connect and listen addresses when using IPCNetworkInterface. That was causing some nasty crash in the Transport without users understanding the actual problem.
* Validate and sanitise connect and listen addresses when using IPCNetworkInterface. That was causing some nasty crash in the Transport without users understanding the actual problem.

### Changed

* the following components has been renamed: | Original Name | New Name | | ---------------| ---------------| |NetworkSnapshotAckComponent| NetworkSnapshotAck | |IncomingSnapshotDataStreamBufferComponent| IncomingSnapshotDataStreamBuffer | |IncomingRpcDataStreamBufferComponent| IncomingRpcDataStreamBuffer | |OutgoingRpcDataStreamBufferComponent| OutgoingRpcDataStreamBuffer | |IncomingCommandDataStreamBufferComponent| IncomingCommandDataStreamBuffer | |OutgoingCommandDataStreamBufferComponent|OutgoingCommandDataStreamBuffer| |NetworkIdComponent|NetworkId| |CommandTargetComponent|CommandTarget| |GhostComponent|GhostInstance| |GhostChildEntityComponent|GhostChildEntity| |GhostOwnerComponent|GhostOwner| |PredictedGhostComponent|PredictedGhost| |GhostTypeComponent|GhostType| |SharedGhostTypeComponent|GhostTypePartition| |GhostCleanupComponent|GhostCleanup| |GhostPrefabMetaDataComponent|GhostPrefabMetaData| |PredictedGhostSpawnRequestComponent|PredictedGhostSpawnRequest| |PendingSpawnPlaceholderComponent|PendingSpawnPlaceholder| |ReceiveRpcCommandRequestComponent|ReceiveRpcCommandRequest| |SendRpcCommandRequestComponent|SendRpcCommandRequest| |MetricsMonitorComponent|MetricsMonitor|
* The following components have been renamed:
NetworkSnapshotAckComponent: NetworkSnapshotAck,
IncomingSnapshotDataStreamBufferComponent: IncomingSnapshotDataStreamBuffer,
IncomingRpcDataStreamBufferComponent: IncomingRpcDataStreamBuffer,
OutgoingRpcDataStreamBufferComponent: OutgoingRpcDataStreamBuffer,
IncomingCommandDataStreamBufferComponent: IncomingCommandDataStreamBuffer,
OutgoingCommandDataStreamBufferComponent: OutgoingCommandDataStreamBuffer,
NetworkIdComponent: NetworkId,
CommandTargetComponent: CommandTarget,
GhostComponent: GhostInstance,
GhostChildEntityComponent: GhostChildEntity,
GhostOwnerComponent: GhostOwner,
PredictedGhostComponent: PredictedGhost,
GhostTypeComponent: GhostType,
SharedGhostTypeComponent: GhostTypePartition,
GhostCleanupComponent: GhostCleanup,
GhostPrefabMetaDataComponent: GhostPrefabMetaData,
PredictedGhostSpawnRequestComponent: PredictedGhostSpawnRequest,
PendingSpawnPlaceholderComponent: PendingSpawnPlaceholder,
ReceiveRpcCommandRequestComponent: ReceiveRpcCommandRequest,
SendRpcCommandRequestComponent: SendRpcCommandRequest,
MetricsMonitorComponent: MetricsMonitor,

### Removed

* internal ListenAsync/ConnectAsync methods (no visible API changes for the users)
* internal ListenAsync/ConnectAsync methods (no visible API changes for users)

### Fixed

Expand Down Expand Up @@ -41,6 +93,9 @@
* Make EnablePacketLogging component public to allow for per connection debug information.
* Updated `com.unity.transport` dependency to version 2.0.0-pre.6.

### Deprecated
* `ProjectSettings / NetCodeClientTarget` was not actually saved to the ProjectSettings. Instead, it was saved to `EditorPrefs`, breaking build determinism across machines. Now that this has been fixed, your EditorPref has been clobbered, and `ClientSettings.NetCodeClientTarget` has been deprecated (in favour of `NetCodeClientSettings.instance.ClientTarget`).

### Fixed

* An issue with the `NetworkEmulator` in the editor when enabling domain reload (while switching play-mode) that was causing the game to forcibly immediately exit the the play state.
Expand Down Expand Up @@ -195,6 +250,45 @@
* The ClientSimulationSystemGroup ServerTick, ServerTickFraction, InterpolationTick and InterpolationTickFraction has been removed. You can retrieve the same properties from the NetworkTime singleton. Please refer to the `NetworkTime` component documentation for further information about the different timing properties and the flags behaviours.


## [0.51.1] - 2022-06-27

### Changed

* Package Dependencies
* `com.unity.entities` to version `0.51.1`


## [0.51.0] - 2022-05-04

### Changed

* Package Dependencies
* `com.unity.entities` to version `0.51.0`
* Updated transport dependency to 1.0.0.

### Added

* prevent the netcode generator running if the assembly compilation that does not references netcode package.


## [0.50.1] - 2022-03-18

### Added

* Hybrid assemblies will not be included in DOTS Runtime builds.

### Changed

* Changed: Tick systems (Initialization, Simulation, Presentation) are not created as part of the default client-server bootstrap for Hybrid and the Client and Server worlds are updated by the PlayerLoop instead.

### Fixed

* Fixed an exception in `PhysicsWorldHistory` when enabling lag compensation.
* Fixed a rare compile error when source generators found invalid data in the package cache.
* Fixed issue that prevent systems been shown in System Hierarchy window.
* Fixed an issue where RPCs could be lost in rare cases when sending too many of them.
* Fix an incorrect overflow exception when pre-spawned or predicted spawned ghost serialize a subset of the fields.


## [0.50.0] - 2021-09-17

Expand Down
3 changes: 3 additions & 0 deletions Documentation~/index.md
Expand Up @@ -36,3 +36,6 @@ generated class inside the assembly it pertain and modify it there.
// }
```

## Additional resources

* [Prerelease (1.0.0-pre.65) documentation](pre-release.md)
2 changes: 1 addition & 1 deletion Documentation~/physics.md
Expand Up @@ -56,7 +56,7 @@ When a client only physics world exists, all non-ghost dynamic physics objects c
As part of the entity baking process, a _PhysicsWorldIndex_ shared component is added to all the physics entities, indicating
in which world the entity should be part of.
> [!NOTE]
> It is responsibility of the user to setup properly their prefab using the `PhysicBody` inspector, to make them run in the correct physics world.
> It is the responsibility of the user to setup their prefab properly to make them run in the correct physics world. This can be achieved with the `PhysicsWorldIndexAuthoring` component, provided with the Unity Physics package, which allows setting the physics world index for rigid bodies. For more information, please refer to the [Unity Physics documentation](https://docs.unity3d.com/Packages/com.unity.physics@latest/index.html?subfolder=/manual/).
### Interaction in between predicted and client-only physics entities

Expand Down
3 changes: 3 additions & 0 deletions Documentation~/pre-release.md
@@ -0,0 +1,3 @@
# Documentation for pre-release versions of com.unity.netcode

Because of idiosyncrasies with which Unity packages are published, it may be possible to see the documentation for the 1.0.0 version of `com.unity.netcode` before the package itself is available. Should you find yourself in that situation, we've made the [pre-release documentation](images/com.unity.netcode@1.0.zip) available. This offline archive contains a snapshot of documentation for the 1.0.0-pre.65 version.
4 changes: 2 additions & 2 deletions Editor/Authoring/BakedNetCodeComponents.cs
Expand Up @@ -78,7 +78,7 @@ public ulong VariantHash
/// Denotes if this type supports user modification of <see cref="ComponentTypeSerializationStrategy"/>.
/// We obviously support it "implicitly" if we have multiple variant types.
/// </summary>
public bool DoesAllowVariantModification => serializationStrategy.HasDontSupportPrefabOverridesAttribute == 0 && (serializationStrategy.HasSupportsPrefabOverridesAttribute != 0 || HasMultipleVariants) && serializationStrategy.IsInput == 0;
public bool DoesAllowVariantModification => serializationStrategy.HasDontSupportPrefabOverridesAttribute == 0 && serializationStrategy.IsInput == 0;

/// <summary>
/// Denotes if this type supports user modification of <see cref="SendTypeOptimization"/>.
Expand All @@ -88,7 +88,7 @@ public ulong VariantHash
/// <summary>
/// Denotes if this type supports user modification of <see cref="GhostAuthoringInspectionComponent.ComponentOverride.PrefabType"/>.
/// </summary>
public bool DoesAllowPrefabTypeModification => serializationStrategy.HasDontSupportPrefabOverridesAttribute == 0 && serializationStrategy.HasSupportsPrefabOverridesAttribute != 0 && serializationStrategy.IsInput == 0;
public bool DoesAllowPrefabTypeModification => serializationStrategy.HasDontSupportPrefabOverridesAttribute == 0 && serializationStrategy.IsInput == 0;

/// <summary>I.e. Implicitly supports prefab overrides.</summary>
internal bool HasMultipleVariants => availableSerializationStrategies.Length > 1;
Expand Down
2 changes: 1 addition & 1 deletion Editor/Authoring/EntityPrefabComponentsPreview.cs
Expand Up @@ -28,7 +28,7 @@ public void BakeEntireNetcodePrefab(GhostAuthoringComponent authoringComponent,
{
try
{
EditorUtility.DisplayProgressBar($"Baking '{authoringComponent}'", "Baking allows you to view and modify ghost component meta-data.", .9f);
EditorUtility.DisplayProgressBar($"Baking '{authoringComponent}'...", "Baking triggered by the GhostAuthoringInspectionComponent.", .9f);
GhostAuthoringInspectionComponent.forceBake = false;
GhostAuthoringInspectionComponent.forceSave = true;

Expand Down
1 change: 1 addition & 0 deletions Editor/Drawers/BoundingBoxDebugGhostDrawerSystem.cs
Expand Up @@ -15,6 +15,7 @@ namespace Unity.NetCode.Samples.Common
{
[UpdateInGroup(typeof(PresentationSystemGroup))]
[WorldSystemFilter(WorldSystemFilterFlags.ClientSimulation)]
[BurstCompile]
partial class BoundingBoxDebugGhostDrawerClientSystem : SystemBase
{
const string k_ServerColorKey = "BoundingBoxDebugGhostDrawer_ServerColor";
Expand Down
1 change: 0 additions & 1 deletion Editor/PrespawnedGhostPreprocessScene.cs
Expand Up @@ -12,7 +12,6 @@ namespace Unity.NetCode.Editor
/// To overcome that, the SubSceneWithPrespawnGhosts is added at runtime here and a LiveLinkPrespawnSectionReference
/// is also added ot the scene section enity to provide some misisng information about the section is referring to.
/// </summary>
[GenerateTestsForBurstCompatibility]
[BurstCompile]
[WorldSystemFilter(WorldSystemFilterFlags.ClientSimulation | WorldSystemFilterFlags.ServerSimulation | WorldSystemFilterFlags.ThinClientSimulation)]
[UpdateInGroup(typeof(InitializationSystemGroup))]
Expand Down
Expand Up @@ -52,7 +52,10 @@ public unsafe void CopyFromSnapshot(ref Snapshot snapshot, ref IComponentData co
#region __GHOST_COPY_FROM_SNAPSHOT__
component.__GHOST_FIELD_REFERENCE__ = snapshotBefore.__GHOST_FIELD_NAME__;
#endregion

#region __GHOST_COPY_FROM_SNAPSHOT_INTERPOLATE_SETUP__
var __GHOST_FIELD_NAME___Before = snapshotBefore.__GHOST_FIELD_NAME__;
var __GHOST_FIELD_NAME___After = snapshotAfter.__GHOST_FIELD_NAME__;
#endregion
#region __GHOST_COPY_FROM_SNAPSHOT_INTERPOLATE_DISTSQ__
var __GHOST_FIELD_NAME___DistSq = math.distancesq(snapshotBefore.__GHOST_FIELD_NAME__, snapshotAfter.__GHOST_FIELD_NAME__);
#endregion
Expand Down
Expand Up @@ -18,6 +18,7 @@ namespace __GHOST_NAMESPACE__
[System.Runtime.CompilerServices.CompilerGenerated]
[UpdateInGroup(typeof(GhostComponentSerializerCollectionSystemGroup))]
[CreateAfter(typeof(GhostComponentSerializerCollectionSystemGroup))]
[CreateBefore(typeof(DefaultVariantSystemGroup))]
[BakingVersion(true)]
public partial struct GhostComponentSerializerRegistrationSystem : ISystem, IGhostComponentSerializerRegistration
{
Expand Down Expand Up @@ -47,7 +48,6 @@ public void OnCreate(ref SystemState state)
IsInputBuffer = __TYPE_IS_INPUT_BUFFER__,
IsTestVariant = __TYPE_IS_TEST_VARIANT__,
HasDontSupportPrefabOverridesAttribute = __TYPE_HAS_DONT_SUPPORT_PREFAB_OVERRIDES_ATTRIBUTE__,
HasSupportsPrefabOverridesAttribute = __TYPE_HAS_SUPPORTS_PREFAB_OVERRIDES_ATTRIBUTE__,
};
data.AddSerializationStrategy(ref ss);
#endregion
Expand Down
11 changes: 9 additions & 2 deletions Runtime/Authoring/DefaultVariantSystemBase.cs
Expand Up @@ -30,6 +30,7 @@ namespace Unity.NetCode
[WorldSystemFilter(WorldSystemFilterFlags.ServerSimulation | WorldSystemFilterFlags.ClientSimulation |
WorldSystemFilterFlags.ThinClientSimulation | WorldSystemFilterFlags.BakingSystem)]
[CreateAfter(typeof(GhostComponentSerializerCollectionSystemGroup))]
[CreateBefore(typeof(DefaultVariantSystemGroup))]
[UpdateInGroup(typeof(DefaultVariantSystemGroup))]
public abstract partial class DefaultVariantSystemBase : SystemBase
{
Expand Down Expand Up @@ -145,8 +146,14 @@ protected sealed override void OnCreate()
//Some sanity check here are necessary
var defaultVariants = new Dictionary<ComponentType, Rule>();
RegisterDefaultVariants(defaultVariants);
// TODO - Prevent user-code from setting defaults for types with the DontSupportPrefabOverridesAttribute.
var variantRules = World.GetExistingSystemManaged<GhostComponentSerializerCollectionSystemGroup>().DefaultVariantRules;

var ghostComponentSerializerCollection = World.GetExistingSystemManaged<GhostComponentSerializerCollectionSystemGroup>();

#if ENABLE_UNITY_COLLECTIONS_CHECKS
var cache = ghostComponentSerializerCollection.ghostComponentSerializerCollectionDataCache;
cache.ThrowIfNotInRegistrationPhase($"register `DefaultVariantSystemBase` child system `{GetType().Name}` in '{World.Name}'");
#endif
var variantRules = ghostComponentSerializerCollection.DefaultVariantRules;
foreach (var rule in defaultVariants)
variantRules.SetDefaultVariant(rule.Key, rule.Value, this);
Enabled = false;
Expand Down
16 changes: 13 additions & 3 deletions Runtime/Authoring/DefaultVariantSystemGroup.cs
Expand Up @@ -3,10 +3,10 @@
namespace Unity.NetCode
{
/// <summary>
/// Group that contains all the systems responsible to register/setup the default Ghost Variants (see <see cref="GhostComponentVariationAttribute"/>).
/// The system group OnCreate method finalize the default mapping inside its own `OnCreate` method, by collecting from all the registered
/// Group that contains all the systems responsible for registering/setting up the default Ghost Variants (see <see cref="GhostComponentVariationAttribute"/>).
/// The system group OnCreate method finalizes the default mapping inside its own `OnCreate` method, by collecting from all the registered
/// <see cref="DefaultVariantSystemBase"/> systems the set of variant to use.
/// The order in which variants are set in the map is governed by the update order (see <see cref="CreateAfterAttribute"/>, <see cref="CreateBeforeAttribute"/>).
/// The order in which variants are set in the map is governed by the creation order (see <see cref="CreateAfterAttribute"/>, <see cref="CreateBeforeAttribute"/>).
/// <remarks>
/// The group is present in both baking and client/server worlds.
/// </remarks>
Expand All @@ -15,5 +15,15 @@ namespace Unity.NetCode
WorldSystemFilterFlags.ThinClientSimulation | WorldSystemFilterFlags.BakingSystem)]
public partial class DefaultVariantSystemGroup : ComponentSystemGroup
{
protected override void OnCreate()
{
base.OnCreate();

// This may look out of place here, but this SystemGroup is used as a "marker",
// indicating that all "Serializer Registration" and "Default Variant Registration" systems have completed.
// It needed to be a SystemGroup, and "DefaultVariants" are registered at the same time as serializers.
var data = SystemAPI.GetSingletonRW<GhostComponentSerializerCollectionData>().ValueRW;
data.CollectionFinalized.Value = 1;
}
}
}

0 comments on commit 916c73e

Please sign in to comment.