Struct ComponentTypeSerializationStrategy
For internal use only. Stores individual "serialization strategies" (and meta-data) for all netcode-informed components, as well as all variants of these components (GhostComponentVariationAttribute). Thus, maps to the code-generated GhostComponentSerializer ("Default Serializers") as well as all user-created Variants (GhostComponentVariationAttribute). This type also stores instances of the DontSerializeVariant, ClientOnlyVariant, and ServerOnlyVariant.
Note: Serializers are considered "optional". It is perfectly valid for a types "serialization strategy" to be: "Do nothing". An example of this is a component for which a variant has been declared (using the GhostComponentVariationAttribute) but for which serialization is not generated, i.e: the GhostInstance attribute is specified in the base component declaration, but not in a variant. We call these "Empty Variants".
Implements
Inherited Members
Namespace: Unity.NetCode
Assembly: solution.dll
Syntax
public struct ComponentTypeSerializationStrategy : IComparable<ComponentTypeSerializationStrategy>
Remarks
This type was renamed from "VariantType" for 1.0.
Fields
Name | Description |
---|---|
Component | Component that this Variant is associated with. |
DefaultRule | |
DisplayName | The type name, unless it has a Variant (in which case it'll use the Variant Display name... assuming that is not null). |
HasDontSupportPrefabOverridesAttribute | Does this component explicitly opt-out of overrides (regardless of variant count)? |
Hash | Hash identifier for the strategy. Should be non-zero by the time it's used in SelectSerializationStrategyForComponentWithHash(ComponentType, ulong, in NativeList<ComponentTypeSerializationStrategy>, bool). |
IsDefaultSerializer | True if this is the "default" serializer for this component type. I.e. The one generated from the component definition itself (see GhostFieldAttribute and GhostComponentAttribute). |
IsInputBuffer | True if the code-generator determined that this is an input buffer. |
IsInputComponent | True if the code-generator determined that this is an input component (or a variant of one). |
IsTestVariant | True if editor-only. Hides it in the user-facing dropdown. If true; we'll set this variant as the default in the editor, assuming we're unable to find a "proper" default. |
PrefabType | The GhostPrefabType value set in GhostInstance present in the variant declaration. Some variants modify the serialization rules. Default is All |
SelfIndex | Indexer into SerializationStrategies list. |
SendForChildEntities | True if the SendDataForChildEntity flag is true on this variant (if it has one), or this type (if not). |
SendTypeOptimization | Override which client type it will be sent to, if we're able to determine. |
SerializerIndex | Indexes into the Serializers. |
Properties
Name | Description |
---|---|
IsClientOnlyVariant | True if this variant is the ClientOnlyVariant. |
IsDontSerializeVariant | True if this variant is the DontSerializeVariant. |
IsSerialized | True if this variant serializes its data. |
Methods
Name | Description |
---|---|
CompareTo(ComponentTypeSerializationStrategy) | Check if two VariantType are identical. |
ToFixedString() | Logs a burst compatible debug string (if in burst), otherwise logs even more info. |