docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TimeStepApplier

    Takes explicit control of Unity's time loop and advances simulation time only when Step(double) is called, enabling deterministic stepped simulation.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    TimeStepApplier
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(string, float)
    MonoBehaviour.InvokeRepeating(string, float, float)
    MonoBehaviour.CancelInvoke(string)
    MonoBehaviour.IsInvoking(string)
    MonoBehaviour.StartCoroutine(string)
    MonoBehaviour.StartCoroutine(string, object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(string)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(object)
    MonoBehaviour.destroyCancellationToken
    MonoBehaviour.useGUILayout
    MonoBehaviour.didStart
    MonoBehaviour.didAwake
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, out Component)
    Component.TryGetComponent<T>(out T)
    Component.GetComponent(string)
    Component.GetComponentInChildren(Type, bool)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(bool)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, bool)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(bool)
    Component.GetComponentsInChildren<T>(bool, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type, bool)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>(bool)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, bool)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(bool)
    Component.GetComponentsInParent<T>(bool, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.GetComponentIndex()
    Component.CompareTag(string)
    Component.CompareTag(TagHandle)
    Component.SendMessageUpwards(string, object, SendMessageOptions)
    Component.SendMessageUpwards(string, object)
    Component.SendMessageUpwards(string)
    Component.SendMessageUpwards(string, SendMessageOptions)
    Component.SendMessage(string, object)
    Component.SendMessage(string)
    Component.SendMessage(string, object, SendMessageOptions)
    Component.SendMessage(string, SendMessageOptions)
    Component.BroadcastMessage(string, object, SendMessageOptions)
    Component.BroadcastMessage(string, object)
    Component.BroadcastMessage(string)
    Component.BroadcastMessage(string, SendMessageOptions)
    Component.transform
    Component.transformHandle
    Component.gameObject
    Component.tag
    Object.GetEntityId()
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.InstantiateAsync<T>(T)
    Object.InstantiateAsync<T>(T, Transform)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int)
    Object.InstantiateAsync<T>(T, int, Transform)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion, CancellationToken)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, CancellationToken)
    Object.InstantiateAsync<T>(T, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, InstantiateParameters, CancellationToken)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Scene)
    Object.Instantiate<T>(T, InstantiateParameters)
    Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, bool)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsByType<T>(FindObjectsSortMode)
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindFirstObjectByType<T>()
    Object.FindAnyObjectByType<T>()
    Object.FindFirstObjectByType<T>(FindObjectsInactive)
    Object.FindAnyObjectByType<T>(FindObjectsInactive)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.SimulationPro.Foundation.ClockManagement
    Assembly: Unity.SimulationPro.Foundation.dll
    Syntax
    [DisallowMultipleComponent]
    public sealed class TimeStepApplier : MonoBehaviour
    Remarks

    At most one enabled instance may exist at a time. Use Instance or GetOrCreateInstance() to obtain the singleton. Call EnsureSimulatedTime() to create and activate the FoundationClock mode automatically.

    Fields

    DEBUG_DoManualStep

    Debug flag: triggers a single manual time step on the next Update when set to true.

    Declaration
    public bool DEBUG_DoManualStep
    Field Value
    Type Description
    bool

    DEBUG_ManualStepSize

    Debug field: controls the size of the manual time step triggered by DEBUG_DoManualStep.

    Declaration
    [Range(0.001, 10)]
    public float DEBUG_ManualStepSize
    Field Value
    Type Description
    float

    Properties

    AllowTimeAccumulation

    Gets or sets a value indicating whether multiple calls to Step(double) within the same frame are allowed to accumulate rather than being rejected as errors.

    Declaration
    public bool AllowTimeAccumulation { get; set; }
    Property Value
    Type Description
    bool

    ElapsedFixedUpdateTime

    Gets the total simulated time in seconds accumulated by physics (FixedUpdate) steps.

    Declaration
    public double ElapsedFixedUpdateTime { get; }
    Property Value
    Type Description
    double
    Remarks

    May be off by one FixedUpdate delta when queried during the same FixedUpdate cycle unless this component's script execution order is set to run before all other scripts.

    Instance

    Gets the active, enabled TimeStepApplier instance, or null if none exists.

    Declaration
    public static TimeStepApplier Instance { get; }
    Property Value
    Type Description
    TimeStepApplier

    IsInitialized

    Gets a value indicating whether this instance has completed initialization.

    Declaration
    public bool IsInitialized { get; }
    Property Value
    Type Description
    bool

    LastFramePhysicsUpdated

    Gets the frame index of the most recent FixedUpdate in which physics was simulated.

    Declaration
    public int LastFramePhysicsUpdated { get; }
    Property Value
    Type Description
    int

    LastFrameStepRequested

    Gets the frame index of the most recent frame in which Step(double) was called.

    Declaration
    public int LastFrameStepRequested { get; }
    Property Value
    Type Description
    int

    LastFrameStepped

    Gets the frame index of the most recent frame in which a time step was fully resolved.

    Declaration
    public int LastFrameStepped { get; }
    Property Value
    Type Description
    int

    TimeAtFrameStart

    Gets the simulated time in seconds at the start of the current frame, including any pending accumulation from the previous frame's step request.

    Declaration
    public float TimeAtFrameStart { get; }
    Property Value
    Type Description
    float

    TotalTimeRequested

    Gets the total simulated time in seconds that has been requested via Step(double).

    Declaration
    public double TotalTimeRequested { get; }
    Property Value
    Type Description
    double

    Methods

    GetOrCreateInstance()

    Returns the existing TimeStepApplier instance, or creates and initializes a new one on a new GameObject if none is found.

    Declaration
    public static TimeStepApplier GetOrCreateInstance()
    Returns
    Type Description
    TimeStepApplier

    The active TimeStepApplier singleton.

    HardInitialize()

    This will immediately initialize the TimeStepApplier, even if it has already been initialized once -- this is useful when doing multiple simulation runs in the same scene

    Declaration
    public void HardInitialize()

    Step(double)

    Requests that simulation time advance by the specified delta on the next rendered frame.

    Declaration
    public void Step(double requestedTimeDelta)
    Parameters
    Type Name Description
    double requestedTimeDelta

    The amount of simulated time in seconds to advance. Must be greater than zero.

    Remarks

    If called more than once in the same frame and AllowTimeAccumulation is false, an error is logged and the second call is ignored.

    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)