Class DefaultVariantSystemBase
DefaultVariantSystemBase is an abstract base class that should be used to update the default variants in GhostComponentSerializerCollectionData, which contains what serialization variant to use (GhostComponentVariationAttribute) for certain type. A concrete implementation must implement the RegisterDefaultVariants(Dictionary<ComponentType, Rule>) method and add to the dictionary the desired type-variant pairs.
The system must (and will be) created in both runtime and baking worlds. During baking, in particular, the GhostComponentSerializerCollectionSystemGroup is used by the `GhostAuthoringBakingSystem` to configure the ghost prefabs meta-data with the defaults values.
The abstract base class already has the correct flags / update in world attributes set. It is not necessary for the concrete implementation to specify the flags, nor the Unity.Entities.WorldSystemFilterAttribute.
CREATION FLOW
All the default variant systems must be created after the GhostComponentSerializerCollectionSystemGroup (that is responsible to create the the default ghost variant mapping singleton). The `DefaultVariantSystemBase` already has the the correct Unity.Entities.CreateAfterAttribute set, and it is not necessary for the sub-class to add the explicitly add/set this creation order again.
Inherited Members
Namespace: Unity.NetCode
Assembly: Unity.NetCode.dll
Syntax
[WorldSystemFilter(WorldSystemFilterFlags.BakingSystem|WorldSystemFilterFlags.ServerSimulation|WorldSystemFilterFlags.ClientSimulation|WorldSystemFilterFlags.ThinClientSimulation, WorldSystemFilterFlags.Default)]
[CreateAfter(typeof(GhostComponentSerializerCollectionSystemGroup))]
[CreateBefore(typeof(DefaultVariantSystemGroup))]
[UpdateInGroup(typeof(DefaultVariantSystemGroup))]
public abstract class DefaultVariantSystemBase : SystemBase
Remarks
You may have multiple derived systems. They'll all be read from, and conflicts will output errors at bake time, and the latest values will be used.
Methods
RegisterDefaultVariants(Dictionary<ComponentType, Rule>)
Implement this method by adding to the defaultVariants
mapping your
default type->variant DefaultVariantSystemBase.Rule.
Declaration
protected abstract void RegisterDefaultVariants(Dictionary<ComponentType, DefaultVariantSystemBase.Rule> defaultVariants)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<ComponentType, DefaultVariantSystemBase.Rule> | defaultVariants |