Unity 6.3
0 онлайн 70 гостей 3 в системе
Вход

Time.captureDeltaTime

Declaration

public static float captureDeltaTime;

Описание

Замедляет время воспроизведения приложения, чтобы позволить Unity сохранять скриншоты между кадрами.

Если это свойство имеет ненулевое значение, то Time.time увеличивается с интервалом captureDeltaTime (масштабируется на Time.timeScale) независимо от реального времени и продолжительности кадра. Это полезно, если вы хотите записать фильм, где вам нужна постоянная частота кадров и вы хотите оставить достаточно времени между кадрами для сохранения изображений экрана.

Примечание: captureDeltaTime не влияет на Time.unscaledTime. Поэтому, если части вашего приложения зависят от него для анимации или других эффектов, captureDeltaTime может быть недостаточно для записи фильма.

using UnityEngine;
using System.Collections;

// Capture frames as a screenshot sequence. Images are // stored as PNG files in a folder - these can be combined into // a movie using image utility software (eg, QuickTime Pro).

public class ExampleClass : MonoBehaviour { // The folder to contain our screenshots. // If the folder exists we will append numbers to create an empty folder. public string folder = "ScreenshotFolder"; public int frameRate = 25; void Start() { // Set the playback framerate (real time will not relate to game time after this). Time.captureDeltaTime = 1.0f / frameRate;

// Create the folder System.IO.Directory.CreateDirectory(folder); }

void Update() { // Append filename to folder name (format is '0005 shot.png"') string name = string.Format("{0}/{1:D04} shot.png", folder, Time.frameCount);

// Capture the screenshot to the specified file. ScreenCapture.CaptureScreenshot(name); } }