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 |
|---|---|
| BakingOnlyTypeFlag | Bitflag set for component types decorated with the BakingTypeAttribute attribute. |
| BufferComponentTypeFlag | Bitflag set for component types inheriting from IBufferElementData. |
| ChunkComponentTypeFlag | Bitflag set for component types converted into Chunk Components. |
| CleanupBufferComponentTypeFlag | Bitflag set for component types inheriting from ICleanupBufferElementData. |
| CleanupComponentTypeFlag | Bitflag set for component types inheriting from ISystemStateComponentData. |
| CleanupSharedComponentTypeFlag | Bitflag set for component types inheriting from ICleanupSharedComponentData. |
| ClearFlagsMask | Bit mask to clear all flag bits from a TypeIndex /> |
| DefaultBufferCapacityNumerator | BufferCapacity 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... |
| EnableableComponentFlag | Bitflag set for component types inheriting from IEnableableComponent. |
| HasNativeContainerFlag | Bitflag set for component types with NativeContainer data NativeContainerAttribute. |
| HasNoEntityReferencesFlag | Bitflag 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. |
| HasOnAddedCallbackFlag | Bitflag set for component types which have an OnAdded callback |
| HasOnRemovedCallbackFlag | Bitflag set for component types which have an OnRemoved callback |
| IEquatableTypeFlag | Bitflag set for component types inheriting from IEquatable_1. |
| IRefCountedComponentFlag | Bitflag set for component types inheriting from IRefCounted. |
| IsNotChunkSerializableTypeFlag | Bitflag set if a component is not appropriate to be included in chunk serialization. |
| ManagedComponentTypeFlag | Bitflag set for component types requiring managed storage due to being a class type and/or containing managed references. |
| ManagedSharedComponentTypeFlag | Bitflag set for component types inheriting from ISharedComponentData and requiring managed storage due to containing managed references. |
| MaximumChunkCapacity | Maximum number of Entity instances stored in a given Chunk/> |
| MaximumSupportedAlignment | Maximum platform alignment supported when aligning component data in a Chunk/> |
| MaximumTypesCount | Maximum number of unique component types supported by the TypeManager/> |
| ObjectOffset | Offset into managed objects to read instance data |
| SharedComponentTypeFlag | Bitflag set for component types inheriting from ISharedComponentData. |
| TemporaryBakingTypeFlag | Bitflag set for component types decorated with the TemporaryBakingTypeAttribute attribute. |
| TransformComponentTypeFlag | Bitflag set for component types that represent a transform/>. |
| ZeroSizeInChunkTypeFlag | Bitflag set for component types which allocate 0 bytes in Chunk storage |
Static Properties
Property | Description |
|---|---|
| AllTypes | Enumerable list of all component TypeManager.TypeInfo values. |
Static Methods
Method | Description |
|---|---|
| CalculateFullNameHash | Calculate a hash for a component's full type name. Used at TypeManager initialization internally. |
| CallIRefCounted_Release | Used by codegen |
| CallIRefCounted_Retain | Used by codegen |
| ConstructComponentFromBuffer | Used by codegen. Create an instance of a component type from a given buffer of data |
| ConstructSystem | Construct a System from a Type. Uses the same list in TypeManager.GetSystems. |
| Equals | Compares two component instances to one another |
| GetDescendantCount | Returns how many component types are known to the TypeManager that inherit from a given component type |
| GetEntityOffsets | Gets a pointer to entity offsets for a given type index. |
| GetFullNameHash | Retrieves a pre-calculated hash for a component's full type name. |
| GetHashCode | Generates a hash for a given component instance |
| GetIEquatable_EqualsFn | Used by codegen |
| GetIEquatable_GetHashCodeFn | Used by codegen |
| GetSystemAttributes | Get all the attribute objects of Type attributeType for a System. |
| GetSystemName | Retrieve the name of a system via its type. |
| GetSystems | Return 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. |
| GetSystemType | Gets the Type for a system from its SystemTypeIndex. |
| GetSystemTypeFlags | Retrieve type flags for a system index. |
| GetSystemTypeIndex | Gets the SystemTypeIndex for the given system type. |
| GetSystemTypeIndices | Return 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. |
| GetType | Gets the System.Type for the component represented by TypeIndex. |
| GetTypeCount | Gets the total number of components managed by the TypeManager. |
| GetTypeIndex | Fetches the TypeIndex for a given System.Type. |
| GetTypeIndexFromStableTypeHash | Returns the TypeIndex for a given TypeManager.TypeInfo.StableTypeHash |
| GetTypeInfo | Retrieve the TypeInfo for the TypeIndex. |
| HasDescendants | Returns if any component inherits from the provided TypeIndex |
| HasEntityReferences | TypeIndex.HasEntityReferences |
| Initialize | Initializes 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. |
| InitializePendingLifecycleCallbacks | Processes any lifecycle callbacks that were registered before TypeManager was initialized. Called from EntityManager.Initialize() after TypeManager.Initialize(). |
| IsAssemblyReferencingEntities | Determines if an assembly refers to Unity.Entities.dll |
| IsBakingOnlyType | TypeIndex.IsBakingOnlyType |
| IsBuffer | TypeIndex.IsBuffer |
| IsChunkComponent | TypeIndex.IsChunkComponent |
| IsCleanupComponent | TypeIndex.IsCleanupComponent |
| IsCleanupSharedComponent | TypeIndex.IsCleanupSharedComponent |
| IsDescendantOf | Used to determine if a component inherits from another component type |
| IsEnableable | TypeIndex.IsEnableable |
| IsEnableableType | TypeIndex.IsEnableable |
| IsIEquatable | TypeIndex.IsIEquatable |
| IsSharedComponentType | TypeIndex.IsSharedComponentType |
| IsSystemAGroup | Check if the provided type is a SystemGroup. |
| IsSystemManaged | Check if the provided type is a managed system. |
| IsSystemType | Determines if a given type is a System type (e.g. ISystem, SystemBase). |
| IsTemporaryBakingType | TypeIndex.IsTemporaryBakingType |
| IsTransform | TypeIndex.IsTransform |
| IsZeroSized | TypeIndex.IsZeroSized |
| MakeChunkComponentTypeIndex | Creates a new TypeIndex that allows the passed in 'typeindex' to be used as a chunk component. |
| RegisterComponentLifecycleCallback | Used by ILPP-generated code to register component lifecycle callbacks. Called from generated EarlyInit() methods. |
| RegisterUnityEngineObjectType | Register a UnityEngine.Object type with the TypeManager. |
| SetIEquatable_EqualsFn | Used by codegen |
| SetIEquatable_GetHashCodeFn | Used by codegen |
| SetIRefCounted_ReleaseFn | Used by codegen |
| SetIRefCounted_RetainFn | Used by codegen |
| Shutdown | Removes all ECS type information and any allocated memory. May only be called once globally, and must be called from the main thread. |
| SortSystemTypesInCreationOrder | Sorts a list of system types based on rules defined via the ISystemOrderAttribute's. CreateBeforeAttribute and CreateAfterAttribute. |
Classes
Class | Description |
|---|---|
| TypeManager.ForcedMemoryOrderingAttribute | Attribute 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.TypeVersionAttribute | TypeVersion 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.EntityOffsetInfo | Stores the byte offset into a component where an Entity member is stored. |
| TypeManager.ManagedSharedComponentFnPtrs | Used by codegen. Managed delegates for ISharedComponentData method overloads, called from code that isn't Burst compiled |
| TypeManager.SharedComponentFnPtrs | Used by codegen. Function pointer wrapper for unmanaged ISharedComponentData method overloads |
| TypeManager.SystemAttribute | Information about the System. It provides access to the SystemTypeIndex. |
| TypeManager.TypeInfo | Provides 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.SystemAttributeKind | Options for the kinds of attributes that can be added to systems. These dictate the execution order of their OnCreate and OnUpdate functions. |
| TypeManager.TypeCategory | Specifies categories of types the TypeManager manages. |
Delegates
Delegate | Description |
|---|---|
| TypeManager.ComponentLifecycleDelegate | Delegate type for component lifecycle callbacks (IDebugOnAdded/IDebugOnRemoved). Used by ILPP-generated wrapper code. |