Set Capture Framerate#
Time / Set Capture Framerate
Description#
Locks the frame rate for deterministic capture, or sets it to zero to play in real time
Parameters#
| Name | Description |
|---|---|
| Framerate | The fixed frame rate to render at. Zero disables capture and plays in real time |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Set Capture Framerate")]
[Image(typeof(IconClock), ColorTheme.Type.Blue, typeof(BadgeSpeed))]
[Description("Locks the frame rate for deterministic capture, or sets it to zero to play in real time")]
[Category("Time/Set Capture Framerate")]
[Parameter("Framerate", "The fixed frame rate to render at. Zero disables capture and plays in real time")]
[Keywords("Record", "Capture", "Screenshot", "Video", "FPS", "Frame", "Rate", "Deterministic")]
[Serializable]
public class InstructionCoreTimeSetCaptureFramerate : Instruction
{
[SerializeField] private GetInteger m_Framerate = new GetInteger(0);
protected override string GetTitle(GameObject source)
{
string framerate = TextUtils.ThemeAsKeyword("Capture Framerate");
return $"Set {framerate} = {this.m_Framerate}";
}
protected override Awaitable Run(Args args)
{
Time.captureFramerate = Mathf.Max(0, this.m_Framerate.GetInt(args));
return Done;
}
}
}