Class JobComponentSystem | Entities | 0.2.0-preview.18
docs.unity3d.com
    Show / Hide Table of Contents

    Class JobComponentSystem

    An abstract class to implement in order to create a system that uses ECS-specific Jobs.

    Inheritance
    Object
    ComponentSystemBase
    JobComponentSystem
    CompositeRotationSystem
    CompositeScaleSystem
    CopyInitialTransformFromGameObjectSystem
    CopyTransformFromGameObjectSystem
    CopyTransformToGameObjectSystem
    LocalToParentSystem
    ParentScaleInverseSystem
    ParentSystem
    PostRotationEulerSystem
    RotationEulerSystem
    TRSToLocalToParentSystem
    TRSToLocalToWorldSystem
    WorldToLocalSystem
    Inherited Members
    ComponentSystemBase.Enabled
    ComponentSystemBase.EntityQueries
    ComponentSystemBase.GlobalSystemVersion
    ComponentSystemBase.LastSystemVersion
    ComponentSystemBase.EntityManager
    ComponentSystemBase.World
    ComponentSystemBase.Time
    ComponentSystemBase.OnCreateForCompiler()
    ComponentSystemBase.OnCreate()
    ComponentSystemBase.OnDestroyManager()
    ComponentSystemBase.OnCreateManager()
    ComponentSystemBase.OnStartRunning()
    ComponentSystemBase.OnStopRunning()
    ComponentSystemBase.OnDestroy()
    ComponentSystemBase.Update()
    ComponentSystemBase.ShouldRunSystem()
    ComponentSystemBase.GetArchetypeChunkComponentType<T>(Boolean)
    ComponentSystemBase.GetArchetypeChunkComponentTypeDynamic(ComponentType)
    ComponentSystemBase.GetArchetypeChunkBufferType<T>(Boolean)
    ComponentSystemBase.GetArchetypeChunkSharedComponentType<T>()
    ComponentSystemBase.GetArchetypeChunkEntityType()
    ComponentSystemBase.GetComponentDataFromEntity<T>(Boolean)
    ComponentSystemBase.RequireForUpdate(EntityQuery)
    ComponentSystemBase.RequireSingletonForUpdate<T>()
    ComponentSystemBase.HasSingleton<T>()
    ComponentSystemBase.GetSingleton<T>()
    ComponentSystemBase.SetSingleton<T>(T)
    ComponentSystemBase.GetSingletonEntity<T>()
    ComponentSystemBase.GetEntityQuery(ComponentType[])
    ComponentSystemBase.GetEntityQuery(NativeArray<ComponentType>)
    ComponentSystemBase.GetEntityQuery(EntityQueryDesc[])
    Namespace: Unity.Entities
    Syntax
    public abstract class JobComponentSystem : ComponentSystemBase
    Remarks

    Implement a JobComponentSystem subclass for systems that perform their work using IJobForEach<T0> or IJobChunk.

    Properties

    Entities

    Use Entities.ForEach((ref Translation translation, in Velocity velocity) => { translation.Value += velocity.Value * dt; }).Schedule(inputDependencies);

    Declaration
    protected ForEachLambdaJobDescription Entities { get; }
    Property Value
    Type Description
    Unity.Entities.CodeGeneratedJobForEach.ForEachLambdaJobDescription

    Job

    Use Job.WithCode(() => { YourCodeGoesHere(); }).Schedule(inputDependencies);

    Declaration
    protected LambdaSingleJobDescription Job { get; }
    Property Value
    Type Description
    Unity.Entities.CodeGeneratedJobForEach.LambdaSingleJobDescription

    Methods

    GetBufferFromEntity<T>(Boolean)

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

    Declaration
    public BufferFromEntity<T> GetBufferFromEntity<T>(bool isReadOnly = false)
        where T : struct, IBufferElementData
    Parameters
    Type Name Description
    Boolean isReadOnly

    Whether the buffer data is only read or is also written. Access data in a read-only fashion whenever possible.

    Returns
    Type Description
    BufferFromEntity<T>

    An array-like object that provides access to buffers, indexed by Entity.

    Type Parameters
    Name Description
    T

    The type of IBufferElementData stored in the buffer.

    Remarks

    Assign the returned object to a field of your Job struct so that you can access the contents of the buffer in a Job.

    See Also
    ComponentDataFromEntity<T>

    OnUpdate(JobHandle)

    Implement OnUpdate to perform the major work of this system.

    Declaration
    protected abstract JobHandle OnUpdate(JobHandle inputDeps)
    Parameters
    Type Name Description
    JobHandle inputDeps

    Existing dependencies for this system.

    Returns
    Type Description
    JobHandle

    A Job handle that contains the dependencies of the Jobs in this system.

    Remarks

    The system invokes OnUpdate once per frame on the main thread when any of this system's EntityQueries match existing entities, or if the system has the AlwaysUpdate attribute.

    To run a Job, create an instance of the Job struct, assign appropriate values to the struct fields and call one of the Job schedule functions. The system passes any current dependencies between Jobs -- which can include Jobs internal to this system, such as gathering entities or chunks, as well as Jobs external to this system, such as Jobs that write to the components read by this system -- in the inputDeps parameter. Your function must combine the input dependencies with any dependencies of the Jobs created in OnUpdate and return the combined object.

    Extension Methods

    ComponentSystemBaseManagedComponentExtensions.HasSingleton<T>(ComponentSystemBase)
    ComponentSystemBaseManagedComponentExtensions.GetSingleton<T>(ComponentSystemBase)
    ComponentSystemBaseManagedComponentExtensions.SetSingleton<T>(ComponentSystemBase, T)
    JobForEachExtensions.GetEntityQueryForIJobForEach(ComponentSystemBase, Type)

    See Also

    ComponentSystem
    Back to top Copyright © 2019 Unity Technologies
    Generated by DocFX