docs.unity3d.com
    Show / Hide Table of Contents

    Struct GhostComponentSerializerCollectionData

    GhostComponentSerializerCollectionSystemGroup. Blittable. For internal use only.

    Inherited Members
    ValueType.Equals(Object)
    ValueType.GetHashCode()
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: Unity.NetCode
    Syntax
    [BurstCompile]
    public struct GhostComponentSerializerCollectionData : IComponentData, IQueryTypeParameter

    Methods

    AddInputComponent(ComponentType, ComponentType)

    Used by code-generated systems and meant for internal use only. Adds a mapping from an IInputComponentData to the buffer it should use.

    Declaration
    public void AddInputComponent(ComponentType inputType, ComponentType bufferType)
    Parameters
    Type Name Description
    ComponentType inputType
    ComponentType bufferType

    AddSerializationStrategy(ref ComponentTypeSerializationStrategy)

    Used by code-generated systems to register SerializationStrategies. Internal use only.

    Declaration
    public void AddSerializationStrategy(ref ComponentTypeSerializationStrategy serializationStrategy)
    Parameters
    Type Name Description
    ComponentTypeSerializationStrategy serializationStrategy

    AddSerializer(GhostComponentSerializer.State)

    Used by code-generated systems and meant for internal use only. Adds the generated ghost serializer to GhostComponentSerializer.State collection.

    Declaration
    public void AddSerializer(GhostComponentSerializer.State state)
    Parameters
    Type Name Description
    GhostComponentSerializer.State state

    Dispose()

    Release the allocated resources used to store the ghost serializer strategies and mappings.

    Declaration
    public void Dispose()

    GetAllAvailableSerializationStrategiesForType(ComponentType, UInt64, Boolean)

    Finds all available variants for a given type, applying all variant rules at once.

    Since multiple variants can be present for any given component there are some important use cases that need to be handled.

    Note that, for IInputBufferDatas, they'll return the variants available to their IInputComponentData authoring struct.

    Note that the number of default variants returned may not be 1 (it could be more or less).

    Declaration
    [BurstCompile]
    public NativeList<ComponentTypeSerializationStrategy> GetAllAvailableSerializationStrategiesForType(ComponentType componentType, ulong chosenVariantHash, bool isRoot)
    Parameters
    Type Name Description
    ComponentType componentType

    Type to find the variant for.

    UInt64 chosenVariantHash

    If set, indicates that a variant has specifically been asked for (as an override). Zero implies find default.

    Boolean isRoot

    True if this component is on the root entity.

    Returns
    Type Description
    NativeList<ComponentTypeSerializationStrategy>

    A list of all available variants for this componentType.

    ThrowIfCollectionNotFinalized(in FixedString512Bytes)

    We have no idea how many code-generated types are left to be registered, so instead, we have a flag that is set when we know ALL of them have been created. If the user queries this collection BEFORE all queries have been created, then they'll get silent errors where GhostFields default to DontSerializeVariant.

    Declaration
    [Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")]
    public void ThrowIfCollectionNotFinalized(in FixedString512Bytes context)
    Parameters
    Type Name Description
    FixedString512Bytes context

    The context of this call, to aid in error reporting.

    Exceptions
    Type Condition
    InvalidOperationException

    Throws if user-code queries too early.

    ThrowIfNoHash(UInt64, FixedString512Bytes)

    Validation that the SourceGenerators return valid hashes for "default serializers".

    Declaration
    [Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")]
    public static void ThrowIfNoHash(ulong hash, FixedString512Bytes context)
    Parameters
    Type Name Description
    UInt64 hash

    Hash to check.

    FixedString512Bytes context
    Exceptions
    Type Condition
    InvalidOperationException

    ThrowIfNotInRegistrationPhase(in FixedString512Bytes)

    We have no idea how many code-generated types are left to be registered, so instead, we have a flag that is set when we know ALL of them have been created. If the user queries this collection BEFORE all queries have been created, then they used to get silent errors where GhostFields default to DontSerializeVariant. This throw highlights that user-error.

    Declaration
    [Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")]
    public void ThrowIfNotInRegistrationPhase(in FixedString512Bytes context)
    Parameters
    Type Name Description
    FixedString512Bytes context

    The context of this call, to aid in error reporting.

    Exceptions
    Type Condition
    InvalidOperationException

    Throws if user-code queries too early.

    TryGetBufferForInputComponent(ComponentType, out ComponentType)

    Lookup a component type to use as a buffer for a given IInputComponentData.

    Declaration
    public bool TryGetBufferForInputComponent(ComponentType inputType, out ComponentType bufferType)
    Parameters
    Type Name Description
    ComponentType inputType
    ComponentType bufferType
    Returns
    Type Description
    Boolean

    True if the component has an assosiated buffer to use, false if it does not.

    Validate()

    Validate that all the serialization strategies have a valid SerializerIndex and that all the SerializationStrategyIndex have been set.

    Declaration
    [Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")]
    public void Validate()
    In This Article
    • Methods
      • AddInputComponent(ComponentType, ComponentType)
      • AddSerializationStrategy(ref ComponentTypeSerializationStrategy)
      • AddSerializer(GhostComponentSerializer.State)
      • Dispose()
      • GetAllAvailableSerializationStrategiesForType(ComponentType, UInt64, Boolean)
      • ThrowIfCollectionNotFinalized(in FixedString512Bytes)
      • ThrowIfNoHash(UInt64, FixedString512Bytes)
      • ThrowIfNotInRegistrationPhase(in FixedString512Bytes)
      • TryGetBufferForInputComponent(ComponentType, out ComponentType)
      • Validate()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023