public sealed class FrameRateDependentExecutionController : ExecutionController
An Exeuction Controller which uses the time the Current frame has run for to determine
whether
execution should start or continue.
Note that once execution starts, it's possible the component using the Execution Controller
will execute for longer
than strictly allowed. This is because some operations may have fixed time costs,
and the execution controller
is only queried between operations. Usually the amount of time it goes over will be
small.
If using multiple Worlds at the same time, each World must use a different instance
of the Execution Controller!
Name | Type | Description |
---|---|---|
FrameTimeLimit | double |
Gets or sets the 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. If the component is already executing, then it will not be allowed to continue executing when a method queries whether it should yield for a frame or continue, 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. |
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).
bool
Returns true when the total time the Current frame has executed for is less than
FrameTimeLimit.
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.
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
FrameTimeLimit. Returns false otherwise.