docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct ComponentType

    A struct to define a component including how it's accessed and what type of component it is

    Namespace: Unity.Entities
    Assembly: Unity.Entities.dll
    Syntax
    [GenerateTestsForBurstCompatibility]
    public struct ComponentType

    Constructors

    Name Description
    ComponentType(Type, AccessMode)

    Create a component type

    Fields

    Name Description
    AccessModeType

    The way the component type will be accessed

    TypeIndex

    A unique index of the component type

    Properties

    Name Description
    HasEntityReferences

    True if any of the fields in the component type are type Entity

    HasNativeContainer

    The component type contains a NativeContainerAttribute decorated member. NativeContainer members found in nested member types will also cause this property to return true.

    IsBuffer

    True if the component type is a IBufferElementData

    IsChunkComponent

    True if the component type is flagged as a chunk component type

    IsChunkSerializable

    True if the component type is appropriate for chunk serialization. Such types are blittable without containing pointer types or have been decorated with ChunkSerializableAttribute.

    IsCleanupBufferComponent

    Bitflag set for component types inheriting from ICleanupBufferElementData.

    IsCleanupComponent

    True if the component type is a ICleanupComponentData

    IsCleanupSharedComponent

    True if the component type is a ICleanupSharedComponentData

    IsComponent

    True if the component type is a IComponentData

    IsEnableable

    True if the component type is a IEnableableComponent

    IsManagedComponent

    True if the component type is a managed component

    IsSharedComponent

    True if the component type is a ISharedComponentData

    IsSystemStateComponent

    Obsolete. Use IsCleanupComponent instead.

    IsSystemStateSharedComponent

    Obsolete. Use IsCleanupComponent instead.

    IsZeroSized

    True if the component type does not contain actual fields or data

    Methods

    Name Description
    ChunkComponent(Type)

    Returns a ComponentType that is a chunk component with ReadWrite based on the type.

    ChunkComponentExclude(Type)

    Returns a ComponentType that is a chunk component with Exclude based on the type.

    ChunkComponentExclude<T>()

    Returns a ComponentType that is a chunk component with Exclude based on the type.

    ChunkComponentReadOnly(Type)

    Returns a ComponentType that is a chunk component with ReadOnly based on the type.

    ChunkComponentReadOnly<T>()

    Returns a ComponentType that is a chunk component with ReadOnly based on the type.

    ChunkComponent<T>()

    Returns a ComponentType that is a chunk component with ReadWrite based on the type.

    Combine(params ComponentType[][])

    Combine multiple array of component type into one. Duplicate types are removed. It will allocate an array containing all component type. Useful for creating queries during initialization of systems.

    CompareTo(ComponentType)

    Returns the sort order this component type compared to another

    Equals(object)

    Checks to see if an object is equal to this component type.

    Equals(ComponentType)

    Checks if this component type has the same TypeIndex and AccessModeType as the other component type.

    Exclude(Type)

    Returns a ComponentType with Exclude based on the type.

    Exclude(TypeIndex)

    Returns a ComponentType with Exclude based on the typeIndex.

    Exclude<T>()

    Returns a ComponentType with Exclude based on the generic type T.

    FromTypeIndex(TypeIndex)

    Returns a ComponentType with ReadWrite based on the typeIndex

    GetHashCode()
    GetManagedType()

    Gets the managed Type based on the component's TypeIndex.

    ReadOnly(Type)

    Returns a ComponentType with ReadOnly based on the type.

    ReadOnly(TypeIndex)

    Returns a ComponentType with ReadOnly based on the typeIndex.

    ReadOnly<T>()

    Returns a ComponentType with ReadOnly based on the generic type T.

    ReadWrite(Type)

    Returns a ComponentType with ReadWrite based on the type.

    ReadWrite(TypeIndex)

    Returns a ComponentType with ReadWrite based on the typeIndex.

    ReadWrite<T>()

    Returns a ComponentType with ReadWrite based on the generic type T.

    ToFixedString()

    Returns a fixed string of the component type

    ToString()

    Returns a managed string of the component type

    Operators

    Name Description
    operator ==(ComponentType, ComponentType)

    Evaluates if two component types are equal based on TypeIndex and AccessModeType.

    operator >(ComponentType, ComponentType)

    Evaluates if one component type is greater than the the other.

    implicit operator ComponentType(Type)

    Creates a new component type based on the type passed in

    operator !=(ComponentType, ComponentType)

    Evaluates if two component types are not equal based on TypeIndex and AccessModeType.

    operator <(ComponentType, ComponentType)

    Evaluates if one component type is less than the the other first by TypeIndex, then by ComponentType.AccessMode.


    Did you find this page useful? Please give it a rating:

    Thanks for rating this page!

    Report a problem on this page

    What kind of problem would you like to report?

    • This page needs code samples
    • Code samples do not work
    • Information is missing
    • Information is incorrect
    • Information is unclear or confusing
    • There is a spelling/grammar error on this page
    • Something else

    Thanks for letting us know! This page has been marked for review based on your feedback.

    If you have time, you can provide more information to help us fix the problem faster.

    Provide more information

    You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:

    You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:

    You've told us there is information missing from this page. Please tell us more about what's missing:

    You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:

    You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:

    You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:

    You've told us this page has a problem. Please tell us more about what's wrong:

    Thank you for helping to make the Unity documentation better!

    Your feedback has been submitted as a ticket for our documentation team to review.

    We are not able to reply to every ticket submitted.

    In This Article
    • Constructors
    • Fields
    • Properties
    • Methods
    • Operators
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)