Class DefaultVariantSystemBase
DefaultVariantSystemBase is an abstract base class that should be used to update the default variants in GhostComponentSerializerCollectionSystemGroup, witch contains what serialization variant to use (GhostComponentVariationAttribute) for certain type. A concrete implementation must implements the RegisterDefaultVariants(Dictionary<ComponentType, Type>) method and add to the dictionary the desired type-variant pairs.
The system must and will be created in both runtime and conversion worlds. During conversion, in particular, the GhostComponentSerializerCollectionSystemGroup is used by the GhostAuthoringConversion to configure the ghost prefabs metadata 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 neither the flags or the update in world.
There is also no particular restriction in witch group the system need run into since all data needed by the runtime is created inside the OnCreate method. As a general rule, if you really need to add an UpdateInGroup attribute, please use only the SimulationSystemGroup as target.
Inherited Members
Namespace: Unity.NetCode
Syntax
[WorldSystemFilter(WorldSystemFilterFlags.Default | WorldSystemFilterFlags.GameObjectConversion)]
[UpdateInWorld(TargetWorld.ClientAndServer)]
public abstract class DefaultVariantSystemBase : ComponentSystem
Methods
OnCreate()
Declaration
protected sealed override void OnCreate()
Overrides
OnUpdate()
Declaration
protected sealed override void OnUpdate()
Overrides
RegisterDefaultVariants(Dictionary<ComponentType, Type>)
Implement this method by adding to the dictionary your default type->variant mapping
Declaration
protected abstract void RegisterDefaultVariants(Dictionary<ComponentType, Type> defaultVariants)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<ComponentType, Type> | defaultVariants |