Documentation

Unity Engine


Unity Engine


TypeManager

The TypeManager registers all Components and Systems available at runtime. Information about components and systems can be retrieved at runtime via static methods on TypeManager. The Initialize() method must be invoked before the TypeManager can be used.
Read time 6 minutesLast updated 2 days ago

Definition

  • Type: Class
  • Namespace: Unity.Entities
  • Assembly: UnityEngine.EntitiesModule
public static class TypeManager

Static Fields

Value

Description

BakingOnlyTypeFlagBitflag set for component types decorated with the BakingTypeAttribute attribute.
BufferComponentTypeFlagBitflag set for component types inheriting from IBufferElementData.
ChunkComponentTypeFlagBitflag set for component types converted into Chunk Components.
CleanupBufferComponentTypeFlagBitflag set for component types inheriting from ICleanupBufferElementData.
CleanupComponentTypeFlagBitflag set for component types inheriting from ISystemStateComponentData.
CleanupSharedComponentTypeFlagBitflag set for component types inheriting from ICleanupSharedComponentData.
ClearFlagsMaskBit mask to clear all flag bits from a TypeIndex />
DefaultBufferCapacityNumeratorBufferCapacity is by default calculated as DefaultBufferCapacityNumerator / sizeof(BufferElementDataType) thus for a 1 byte component, the maximum number of elements possible to be stored in chunk memory before the buffer is allocated separately from chunk data, is DefaultBufferCapacityNumerator elements. For a 2 byte sized component, (DefaultBufferCapacityNumerator / 2) elements can be stored, etc...
EnableableComponentFlagBitflag set for component types inheriting from IEnableableComponent.
HasNativeContainerFlagBitflag set for component types with NativeContainer data NativeContainerAttribute.
HasNoEntityReferencesFlagBitflag set for component types that do not contain an Entity member. Entity members found in nested member types will cause this bitflag to not be set.
HasOnAddedCallbackFlagBitflag set for component types which have an OnAdded callback
HasOnRemovedCallbackFlagBitflag set for component types which have an OnRemoved callback
IEquatableTypeFlagBitflag set for component types inheriting from IEquatable_1.
IRefCountedComponentFlagBitflag set for component types inheriting from IRefCounted.
IsNotChunkSerializableTypeFlagBitflag set if a component is not appropriate to be included in chunk serialization.
ManagedComponentTypeFlagBitflag set for component types requiring managed storage due to being a class type and/or containing managed references.
ManagedSharedComponentTypeFlagBitflag set for component types inheriting from ISharedComponentData and requiring managed storage due to containing managed references.
MaximumChunkCapacityMaximum number of Entity instances stored in a given Chunk/>
MaximumSupportedAlignmentMaximum platform alignment supported when aligning component data in a Chunk/>
MaximumTypesCountMaximum number of unique component types supported by the TypeManager/>
ObjectOffsetOffset into managed objects to read instance data
SharedComponentTypeFlagBitflag set for component types inheriting from ISharedComponentData.
TemporaryBakingTypeFlagBitflag set for component types decorated with the TemporaryBakingTypeAttribute attribute.
TransformComponentTypeFlagBitflag set for component types that represent a transform/>.
ZeroSizeInChunkTypeFlagBitflag set for component types which allocate 0 bytes in Chunk storage

Static Properties

Property

Description

AllTypesEnumerable list of all component TypeManager.TypeInfo values.

Static Methods

Method

Description

CalculateFullNameHashCalculate a hash for a component's full type name. Used at TypeManager initialization internally.
CallIRefCounted_ReleaseUsed by codegen
CallIRefCounted_RetainUsed by codegen
ConstructComponentFromBufferUsed by codegen. Create an instance of a component type from a given buffer of data
ConstructSystemConstruct a System from a Type. Uses the same list in TypeManager.GetSystems.
EqualsCompares two component instances to one another
GetDescendantCountReturns how many component types are known to the TypeManager that inherit from a given component type
GetEntityOffsetsGets a pointer to entity offsets for a given type index.
GetFullNameHashRetrieves a pre-calculated hash for a component's full type name.
GetHashCodeGenerates a hash for a given component instance
GetIEquatable_EqualsFnUsed by codegen
GetIEquatable_GetHashCodeFnUsed by codegen
GetSystemAttributesGet all the attribute objects of Type attributeType for a System.
GetSystemNameRetrieve the name of a system via its type.
GetSystemsReturn an array of all System types available to the runtime matching the WorldSystemFilterFlags. By default, all systems available to the runtime is returned. Prefer GetSystemTypeIndices over this to avoid unnecessary reflection.
GetSystemTypeGets the Type for a system from its SystemTypeIndex.
GetSystemTypeFlagsRetrieve type flags for a system index.
GetSystemTypeIndexGets the SystemTypeIndex for the given system type.
GetSystemTypeIndicesReturn an array of all System types available to the runtime matching the WorldSystemFilterFlags. By default, all systems available to the runtime is returned. This version avoids unnecessary reflection.
GetTypeGets the System.Type for the component represented by TypeIndex.
GetTypeCountGets the total number of components managed by the TypeManager.
GetTypeIndexFetches the TypeIndex for a given System.Type.
GetTypeIndexFromStableTypeHashReturns the TypeIndex for a given TypeManager.TypeInfo.StableTypeHash
GetTypeInfoRetrieve the TypeInfo for the TypeIndex.
HasDescendantsReturns if any component inherits from the provided TypeIndex
HasEntityReferencesTypeIndex.HasEntityReferences
InitializeInitializes the TypeManager with all ECS type information. May be called multiple times; only the first call will do any work. Always must be called from the main thread.
InitializePendingLifecycleCallbacksProcesses any lifecycle callbacks that were registered before TypeManager was initialized. Called from EntityManager.Initialize() after TypeManager.Initialize().
IsAssemblyReferencingEntitiesDetermines if an assembly refers to Unity.Entities.dll
IsBakingOnlyTypeTypeIndex.IsBakingOnlyType
IsBufferTypeIndex.IsBuffer
IsChunkComponentTypeIndex.IsChunkComponent
IsCleanupComponentTypeIndex.IsCleanupComponent
IsCleanupSharedComponentTypeIndex.IsCleanupSharedComponent
IsDescendantOfUsed to determine if a component inherits from another component type
IsEnableableTypeIndex.IsEnableable
IsEnableableTypeTypeIndex.IsEnableable
IsIEquatableTypeIndex.IsIEquatable
IsSharedComponentTypeTypeIndex.IsSharedComponentType
IsSystemAGroupCheck if the provided type is a SystemGroup.
IsSystemManagedCheck if the provided type is a managed system.
IsSystemTypeDetermines if a given type is a System type (e.g. ISystem, SystemBase).
IsTemporaryBakingTypeTypeIndex.IsTemporaryBakingType
IsTransformTypeIndex.IsTransform
IsZeroSizedTypeIndex.IsZeroSized
MakeChunkComponentTypeIndexCreates a new TypeIndex that allows the passed in 'typeindex' to be used as a chunk component.
RegisterComponentLifecycleCallbackUsed by ILPP-generated code to register component lifecycle callbacks. Called from generated EarlyInit() methods.
RegisterUnityEngineObjectTypeRegister a UnityEngine.Object type with the TypeManager.
SetIEquatable_EqualsFnUsed by codegen
SetIEquatable_GetHashCodeFnUsed by codegen
SetIRefCounted_ReleaseFnUsed by codegen
SetIRefCounted_RetainFnUsed by codegen
ShutdownRemoves all ECS type information and any allocated memory. May only be called once globally, and must be called from the main thread.
SortSystemTypesInCreationOrderSorts a list of system types based on rules defined via the ISystemOrderAttribute's. CreateBeforeAttribute and CreateAfterAttribute.

Classes

Class

Description

TypeManager.ForcedMemoryOrderingAttributeAttribute to force the TypeManager.TypeInfo.MemoryOrdering for a component to a specific value.
TypeManager.ForceReferenceAttribute[ForceReferenceSearch] can be applied to a component that is known to contain Entity, Blob and/or UnityObject references, in case that the reference is nested beyond the max search depth and can therefore not normally be found.
TypeManager.TypeOverridesAttribute[TypeOverrides] can be applied to a component that is known to contain Entity, Blob and/or UnityObject references, in order to reduce time taken during serialization operations.
TypeManager.TypeVersionAttributeTypeVersion allows you to override the TypeManager.TypeInfo.StableTypeHash for a component type to a specific value rather than using the default generated hash.

Structs

Struct

Description

TypeManager.EntityOffsetInfoStores the byte offset into a component where an Entity member is stored.
TypeManager.ManagedSharedComponentFnPtrsUsed by codegen. Managed delegates for ISharedComponentData method overloads, called from code that isn't Burst compiled
TypeManager.SharedComponentFnPtrsUsed by codegen. Function pointer wrapper for unmanaged ISharedComponentData method overloads
TypeManager.SystemAttributeInformation about the System. It provides access to the SystemTypeIndex.
TypeManager.TypeInfoProvides information about component types such as their runtime size, how much space they use in Chunk storage, their TypeManager.TypeInfo.TypeIndex, how many entity references they contain, and more.

Enums

Enum

Description

TypeManager.SystemAttributeKindOptions for the kinds of attributes that can be added to systems. These dictate the execution order of their OnCreate and OnUpdate functions.
TypeManager.TypeCategorySpecifies categories of types the TypeManager manages.

Delegates

Delegate

Description

TypeManager.ComponentLifecycleDelegateDelegate type for component lifecycle callbacks (IDebugOnAdded/IDebugOnRemoved). Used by ILPP-generated wrapper code.