FrameRateDependentTimeSlicedExecutionController Class

public sealed class FrameRateDependentTimeSlicedExecutionController : ExecutionController

An Exeuction Controller which uses the time the Current frame has run for to determine whether execution should start. Once started, execution will continue for a pre-set time, set via the Time Slice setting.

This time slice is approximate. In some instances the component using the Execution Controller may need to yield early or may exceed the time slice by a small amount.

If using multiple Worlds at the same time, each World must use a different instance of the Execution Controller!

Properties

Name Type Description
ExecutionStartFrameTimeLimit double

Gets or sets the execution start frame time limit. The component that uses this execution controller will not be allowed to execute if the amount of time the Current frame has taken is greater than this value.

SuspensionFrameLimit int

Gets or sets the suspension frame limit. This is used to avoid situations where the component that uses the execution controller would never start executing because the frame time is always greater than the Frame Time Limit. Once the component has been suspended for this number of frames, the next execution is started no matter the frame time.

TimeSlice double

The amount of time (in seconds) that the component that uses this execution controller can execute for (not guaranteed).

Methods

ShouldContinueExecuting()

public override bool ShouldContinueExecuting()

When the component which uses the execution controller wants to know whether it should yield for a frame or continue executing, this method is queried.

Note there are a lot of methods that don't use this strategy, but instead need to always yield for a frame or on some other property (WaitForSeconds for example).

Returns

bool
Returns true when the component using this execution controller has run for less time than TimeSlice.


ShouldStartExecuting()

public override bool ShouldStartExecuting()

For every frame that the component which uses this execution controller is set to execute, this method will be queried to determine whether the component should execute.

Returns

bool
Returns true if the components exuction has been restricted from starting for a number of frames equal to SuspensionFrameLimit or if the Current frame has been running for less than ExecutionStartFrameTimeLimit. Returns false otherwise.