docs.unity3d.com
    Show / Hide Table of Contents

    Class ComponentSystemBase

    A system provides behavior in an ECS architecture.

    Inheritance
    Object
    ComponentSystemBase
    ComponentSystem
    SystemBase
    Namespace: Unity.Entities
    Syntax
    public abstract class ComponentSystemBase
    Remarks

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

    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.

    SystemHandleUntyped

    The SystemHandleUntyped of this system.

    Time

    The current Time data for this system's world.

    World

    The World in which this system exists.

    Methods

    Name Description
    GetBufferFromEntity<T>(Boolean)

    Gets a BufferFromEntity<T> object that can access a DynamicBuffer<T>.

    GetBufferTypeHandle<T>(Boolean)

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

    GetComponentDataFromEntity<T>(Boolean)

    Gets an dictionary-like container containing all components of type T, keyed by Entity.

    GetComponentTypeHandle<T>(Boolean)

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

    GetDynamicComponentTypeHandle(ComponentType)

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

    GetDynamicSharedComponentTypeHandle(ComponentType)

    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(EntityQueryDesc[])

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

    GetEntityTypeHandle()

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

    GetSharedComponentTypeHandle<T>()

    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.

    GetSingletonEntity<T>()

    Gets the Entity instance for a singleton.

    GetStorageInfoFromEntity()

    Gets a StorageInfoFromEntity object that can access a EntityStorageInfo.

    HasSingleton<T>()

    Checks whether a singelton component of the specified type exists.

    OnCreate()

    Called when this system is created.

    OnCreateForCompiler()
    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.

    RequireForUpdate(EntityQuery)

    Adds a query that must return 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.

    RequireSingletonForUpdate<T>()

    Require that a specific singleton component exist for this system to run.

    SetSingleton<T>(T)

    Sets the value of a singleton component.

    ShouldRunSystem()

    Reports whether any of this system's entity queries currently match any chunks. 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.

    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.SetSingleton<T>(ComponentSystemBase, T)
    In This Article
    • Properties
    • Methods
    • Extension Methods
    Back to top
    Terms of use
    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