Set Fixed Delta Time#
Time / Set Fixed Delta Time
Description#
Sets the interval in seconds at which physics and fixed frame updates are performed
Parameters#
| Name | Description |
|---|---|
| Fixed Delta Time | The fixed time step in seconds used by the physics update |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Set Fixed Delta Time")]
[Image(typeof(IconClock), ColorTheme.Type.Blue, typeof(BadgeDelta))]
[Description("Sets the interval in seconds at which physics and fixed frame updates are performed")]
[Category("Time/Set Fixed Delta Time")]
[Parameter("Fixed Delta Time", "The fixed time step in seconds used by the physics update")]
[Keywords("Physics", "Fixed", "Update", "Step", "Interval", "Delta")]
[Serializable]
public class InstructionCoreTimeSetFixedDeltaTime : Instruction
{
[SerializeField] private GetNumber m_FixedDeltaTime = new GetNumber(0.02);
protected override string GetTitle(GameObject source)
{
string fixedTime = TextUtils.ThemeAsKeyword("Fixed Delta Time");
return $"Set {fixedTime} = {this.m_FixedDeltaTime}";
}
protected override Awaitable Run(Args args)
{
Time.fixedDeltaTime = Mathf.Max(0f, (float) this.m_FixedDeltaTime.Get(args));
return Done;
}
}
}