Class SchedulePausingBehaviour
A default IPauseCondition implementation for MonoBehaviours that need to pause simulation time after every clock update until a condition is cleared.
Implements
Inherited Members
Namespace: Unity.SimulationPro.Foundation
Assembly: Unity.SimulationPro.Foundation.dll
Syntax
public class SchedulePausingBehaviour : MonoBehaviour, IPauseCondition
Remarks
Inherit from this class or add it as a required component to integrate with the TimeStepScheduler. Set ShouldRequestPause to false when your logic has finished processing the current time step.
Properties
IsActive
Gets a value indicating whether this condition should be evaluated by the scheduler.
Declaration
public virtual bool IsActive { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Most implementations map this to MonoBehaviour.isActiveAndEnabled.
RequestsPause
Gets a value indicating whether this condition is currently requesting that time be paused.
Declaration
public virtual bool RequestsPause { get; }
Property Value
| Type | Description |
|---|---|
| bool |
ShouldRequestPause
Gets or sets a value indicating whether this behaviour is currently requesting a simulation pause. Setting this property fires OnStateChange when the value changes and the behaviour is active.
Declaration
public bool ShouldRequestPause { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
StartPaused
Gets or sets a value indicating whether the behaviour begins in a paused state when the scene starts.
Declaration
public bool StartPaused { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
Awake()
Initializes the pause state from StartPaused.
Declaration
protected virtual void Awake()
OnDisable()
Fires OnStateChange when this behaviour is disabled so the scheduler can update its count.
Declaration
protected virtual void OnDisable()
OnEnable()
Fires OnStateChange if this behaviour was already requesting a pause when re-enabled.
Declaration
protected virtual void OnEnable()
UpdateState()
Called by the scheduler after time has advanced to allow this condition to re-evaluate its state.
Declaration
public virtual void UpdateState()
Remarks
Implementations may re-assert the pause request here, or use any custom logic to decide whether to set RequestsPause to true again.
Events
OnStateChange
Raised whenever RequestsPause or IsActive changes. The TimeStepScheduler subscribes to this event to update its internal pause count.
Declaration
public event EventHandler OnStateChange
Event Type
| Type | Description |
|---|---|
| EventHandler |