Class GhostComponentVariationAttribute
Generate a serialization variant for a component using the GhostFieldAttribute annotations present in variant declaration. The component variant can be assigned at authoring time using the GhostAuthoringComponent editor.
Note: This is incompatible with any type implementing DontSupportPrefabOverridesAttribute.
Implements
Inherited Members
Namespace: Unity.NetCode
Assembly: solution.dll
Syntax
[AttributeUsage(AttributeTargets.Struct)]
public class GhostComponentVariationAttribute : Attribute, _Attribute
Constructors
Name | Description |
---|---|
GhostComponentVariationAttribute(Type, string, bool) | Initialize and declare the variant for a given component type. We can't constrain on a specific interface, thus, the validation is done at compile time in the constructor (for now). |
Fields
Name | Description |
---|---|
ComponentType | Type that this variant is overriding. Assigned at construction time. |
Properties
Name | Description |
---|---|
DisplayName | User friendly, readable name for the variant. Used mainly for UI and logging purposes. If not assigned at construction time, the annotated class name will be used instead. "Default", "ClientOnly" and "DontSerialize" are not valid names and will be treated as null. |
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. |
VariantHash | The unique hash for the component variation. The hash is computed at compile time (assigned to the generated serialization class) and then assigned at runtime to the attribute when all the variant are registered by the GhostComponentSerializerCollectionSystemGroup. The hash itself is then used at both edit and runtime to identify the variation used for each component. |