docs.unity.cn
    Show / Hide Table of Contents

    Class ComponentSystemBase

    A system provides behavior in an ECS architecture.

    Inheritance
    Object
    ComponentSystemBase
    SystemBase
    Namespace: Unity.Entities
    Syntax
    [RequireDerived]
    public abstract class ComponentSystemBase
    Remarks

    System implementations should inherit SystemBase, which is a subclass of ComponentSystemBase.

    Constructors

    Name Description
    ComponentSystemBase()

    Initializes and returns an instance of a system.

    Properties

    Name Description
    Enabled

    Controls whether this system executes when its OnUpdate function is called.

    EntityManager

    The EntityManager object of the World in which this system exists.

    EntityQueries

    The query objects cached by this system.

    GlobalSystemVersion

    The current change version number in this World.

    LastSystemVersion

    The current version of this system.

    SystemHandle

    The SystemHandle of this system.

    SystemHandleUntyped

    Obsolete. Use SystemHandle instead.

    Time

    Obsolete. Use Time or Time instead.

    World

    The World in which this system exists.

    WorldUpdateAllocator

    Retrieve world update allocator from system state.

    Methods

    Name Description
    GetBufferFromEntity<T>(Boolean)

    Obsolete. Use GetBufferLookup<T>(Boolean) instead.

    GetBufferLookup<T>(Boolean)

    Manually gets a BufferLookup<T> object that can access a DynamicBuffer<T>.

    GetBufferTypeHandle<T>(Boolean)

    Manually gets the run-time type information required to access an array of buffer components in a chunk.

    GetComponentDataFromEntity<T>(Boolean)

    Obsolete. Use GetComponentLookup<T>(Boolean) instead.

    GetComponentLookup<T>(Boolean)

    Manually gets a dictionary-like container containing all components of type T, keyed by Entity.

    GetComponentTypeHandle<T>(Boolean)

    Manually gets the run-time type information required to access an array of component data in a chunk.

    GetDynamicComponentTypeHandle(ComponentType)

    Manually gets the run-time type information required to access an array of component data in a chunk.

    GetDynamicSharedComponentTypeHandle(ComponentType)

    Manually gets the run-time type information required to access a shared component data in a chunk.

    GetEntityQuery(NativeArray<ComponentType>)

    Gets the cached query for the specified component types, if one exists; otherwise, creates a new query instance and caches it.

    GetEntityQuery(ComponentType[])

    Gets the cached query for the specified component types, if one exists; otherwise, creates a new query instance and caches it.

    GetEntityQuery(in EntityQueryBuilder)

    Create an entity query from a query description builder.

    GetEntityQuery(EntityQueryDesc[])

    Combines an array of query description objects into a single query.

    GetEntityStorageInfoLookup()

    Manually gets an EntityStorageInfoLookup object that can access a EntityStorageInfo.

    GetEntityTypeHandle()

    Manually gets the run-time type information required to access the array of Entity objects in a chunk.

    GetSharedComponentTypeHandle<T>()

    Manually gets the run-time type information required to access a shared component data in a chunk.

    GetSingleton<T>()

    Gets the value of a singleton component.

    GetSingletonBuffer<T>(Boolean)

    Gets the value of a singleton buffer component.

    GetSingletonEntity<T>()

    Gets the Entity instance for a singleton.

    GetSingletonRW<T>()

    Gets a reference to the singleton component, for read/write access.

    GetStorageInfoFromEntity()

    Obsolete. Use GetEntityStorageInfoLookup() instead.

    HasSingleton<T>()

    Checks whether a singleton component of the specified type exists.

    OnCreate()

    Called when this system is created.

    OnDestroy()

    Called when this system is destroyed.

    OnStartRunning()

    Called before the first call to OnUpdate and when a system resumes updating after being stopped or disabled.

    OnStopRunning()

    Called when this system stops running because no entities match the system's EntityQuery objects or because you change the system Enabled property to false.

    RequireAnyForUpdate(NativeArray<EntityQuery>)

    Provide a set of queries, one of which must match entities for the system to run.

    RequireAnyForUpdate(EntityQuery[])

    Provide a set of queries, one of which must match entities for the system to run.

    RequireForUpdate(EntityQuery)

    Adds a query that must match entities for the system to run. You can add multiple required queries to a system; all of them must match at least one entity for the system to run.

    RequireForUpdate<T>()

    Require that a specific component exist for this system to run. Also includes any components added to a system. See SystemHandle for more info on that.

    RequireSingletonForUpdate<T>()

    Obsolete. Use RequireForUpdate<T>() instead.

    SetSingleton<T>(T)

    Sets the value of a singleton component.

    ShouldRunSystem()

    Reports whether this system satisfies the criteria to update. This function is used internally to determine whether the system's OnUpdate function can be skipped.

    TryGetSingleton<T>(out T)

    Gets the value of a singleton component, and returns whether or not a singleton component of the specified type exists in the World.

    TryGetSingletonBuffer<T>(out DynamicBuffer<T>)

    Gets the value of a singleton buffer component, and returns whether or not a singleton buffer component of the specified type exists in the World.

    TryGetSingletonEntity<T>(out Entity)

    Gets the singleton Entity, and returns whether or not a singleton Entity of the specified type exists in the World.

    Update()

    Executes the system immediately.

    Extension Methods

    ComponentSystemBaseManagedComponentExtensions.GetSingleton<T>(ComponentSystemBase)
    ComponentSystemBaseManagedComponentExtensions.GetSingletonRW<T>(ComponentSystemBase)
    ComponentSystemBaseManagedComponentExtensions.SetSingleton<T>(ComponentSystemBase, T)
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Wednesday, June 21, 2023