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 (Ghost
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 Ghost
Implements
Inherited Members
Namespace: Unity.NetCode
Assembly: Unity.NetCode.dll
Syntax
public struct ComponentTypeSerializationStrategy : IComparable<ComponentTypeSerializationStrategy>
Remarks
This type was renamed from "VariantType" for 1.0.
Fields
Component
Component that this Variant is associated with.
Declaration
public ComponentType Component
Field Value
Type | Description |
---|---|
Component |
DefaultRule
Declaration
public ComponentTypeSerializationStrategy.DefaultType DefaultRule
Field Value
Type | Description |
---|---|
Component |
DisplayName
The type name, unless it has a Variant (in which case it'll use the Variant Display name... assuming that is not null).
Declaration
public FixedString64Bytes DisplayName
Field Value
Type | Description |
---|---|
Fixed |
HasDontSupportPrefabOverridesAttribute
Does this component explicitly opt-out of overrides (regardless of variant count)?
Declaration
public byte HasDontSupportPrefabOverridesAttribute
Field Value
Type | Description |
---|---|
byte |
Hash
Hash identifier for the strategy. Should be non-zero by the time it's used in Select
Declaration
public ulong Hash
Field Value
Type | Description |
---|---|
ulong |
IsDefaultSerializer
True if this is the "default" serializer for this component type.
I.e. The one generated from the component definition itself (see Ghost
Declaration
public byte IsDefaultSerializer
Field Value
Type | Description |
---|---|
byte |
Remarks
Types like Translation
don't have a default serializer as the type itself doesn't define any GhostFields, but they do have serialized variants.
IsInputBuffer
True if the code-generator determined that this is an input buffer.
Declaration
public byte IsInputBuffer
Field Value
Type | Description |
---|---|
byte |
IsInputComponent
True if the code-generator determined that this is an input component (or a variant of one).
Declaration
public byte IsInputComponent
Field Value
Type | Description |
---|---|
byte |
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.
Declaration
public byte IsTestVariant
Field Value
Type | Description |
---|---|
byte |
Remarks
True if this is an editor test variant. Forces this variant to be considered a "default" which makes writing tests easier.
PrefabType
The Ghost
Declaration
public GhostPrefabType PrefabType
Field Value
Type | Description |
---|---|
Ghost |
SelfIndex
Indexer into Serialization
Declaration
public short SelfIndex
Field Value
Type | Description |
---|---|
short |
SendForChildEntities
True if the Send
Declaration
public byte SendForChildEntities
Field Value
Type | Description |
---|---|
byte |
SendTypeOptimization
Override which client type it will be sent to, if we're able to determine.
Declaration
public GhostSendType SendTypeOptimization
Field Value
Type | Description |
---|---|
Ghost |
SerializerIndex
Indexes into the Serializers.
Declaration
public short SerializerIndex
Field Value
Type | Description |
---|---|
short |
Remarks
Serializers are optional. Thus, 0 if this type does not serialize component data.
Properties
IsClientOnlyVariant
True if this variant is the Client
Declaration
public bool IsClientOnlyVariant { get; }
Property Value
Type | Description |
---|---|
bool |
IsDontSerializeVariant
True if this variant is the Dont
Declaration
public bool IsDontSerializeVariant { get; }
Property Value
Type | Description |
---|---|
bool |
IsSerialized
True if this variant serializes its data.
Declaration
public byte IsSerialized { get; }
Property Value
Type | Description |
---|---|
byte |
Remarks
Note that this will also be true if the type has the attribute Ghost
Methods
CompareTo(ComponentTypeSerializationStrategy)
Check if two VariantType are identical.
Declaration
public int CompareTo(ComponentTypeSerializationStrategy other)
Parameters
Type | Name | Description |
---|---|---|
Component |
other | Variant type |
Returns
Type | Description |
---|---|
int | Whether |
ToFixedString()
Logs a burst compatible debug string (if in burst), otherwise logs even more info.
Declaration
public FixedString512Bytes ToFixedString()
Returns
Type | Description |
---|---|
Fixed |
A debug string. |