Give Page Feedback | API

Execution Controllers - Time Sliced Controller

The Time Sliced Execution Controller is designed to limit the amount of time the component that uses it (Using Component) executes for in a given frame. ShouldStartExecuting will always return true and therefore this controller does not ever stop the Using Component from beginning/resuming execution. It can only halt the execution of the Using Component when a special YieldOrContinue instruction is encountered by the Using Component.

Creating A Time Sliced Execution Controller Component

You can add this component by selecting a game object and then selecting from the Top Menu Bar:

Component -> Deep Space Labs -> -> SAM -> Execution Controllers -> Time Sliced Execution Controller

Adding A Time Sliced Execution Controller Component From The Top Menu Bar GIF

or by selecting a game object and using the Add Component menu via its inspector:

Component -> Deep Space Labs -> -> SAM -> Execution Controllers -> Time Sliced Execution Controller

Adding A Time Sliced Execution Controller Component From Add Component Menu GIF

Time Slice Setting

The amount of execution time (in seconds) per frame to try and limit the Using Component to. The amount of time a Using Component has executed is measured from the moment the Time Sliced Controller's ShouldStartExecuting method is queried. Once this time has surpassed the Time Slice value, the next time the Using Component encounters a YieldOrContinue YieldInstruction, it will yield for a frame.

Note that the actual time the Using Component executes in any given frame may be less than or slightly more than this specified value, as there is no guarantee that a YieldInstruction will be encountered around the specified time.

Assigning The Execution Controller

Currently Execution Controllers can only be assigned to a World's Execution Controller field which resides within the Optional Components window.

Remember that all of the default provided Execution Controllers are only intended to be used with a single World component. If you have multiple Worlds, you will need to assign unique Execution Controller component instances to each one.

Single Instance Per World

Each instance of the Time Sliced Execution Controller can only be used with a single World!