# Time

{% embed url="<https://youtu.be/zXwpR4HJq-M>" %}

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FoF91atPvHL7VSSoStOW8%2Fimage.png?alt=media&#x26;token=986b0e49-f38c-4a3e-9519-4e0bce1bb75a" alt=""><figcaption></figcaption></figure>

## Apply Settings to All

This button (in the top right) is only available when multiple Timeflow instances are present. This applies the current time settings to all instances of Timeflow in the scene, which can be used to synchronize all instances with the same framerate, duration, and other settings.

## Display Format

This drop-down menu offers different ways of displaying time. This only affects how time is displayed in the editor and can be changed as needed.

* Seconds (ex: 1.233 seconds)&#x20;
* Frames (ex: 74 frames)
* Timecode (ex: 00:01.233  HH:MM:SS:FS)
* Measures (ex: 1.3.3 - based on the BPM)

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2F4Y3CM02udB17SGLD3czu%2Fimage.png?alt=media&#x26;token=76063e5c-ea82-4484-b733-293acfeb52bf" alt=""><figcaption><p>The Display Format affects the main time display (shown in bold white numbers above).</p></figcaption></figure>

{% hint style="info" %}
&#x20;This can also be changed directly in the view by clicking to the left of each time field. For convenience, the Timeflow view has 2 time displays that can each be set to whichever time format you prefer. The default display shows seconds on top and frames below.
{% endhint %}

{% hint style="info" %}
To enable the Measures time format, enable musical timing by clicking the note icon ![](https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FCJ1JeJLZzqAY3WeaoWdv%2Fimage.png?alt=media\&token=48c5c34a-de70-445e-8970-d85e33de6d83)
{% endhint %}

### Fractional Seconds

Determines how microseconds are displayed when viewing timecode format. When enabled, the fractional time .233 in the example above would equal 23/100s of a second. Alternatively when Fractional Seconds is disabled, the .233 is converted to frames based on the FPS set below, which in this case would be 14 frames (00:01.14). This option is a matter of personal preference and can be set to match external editing software.

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FXIqob4QIJCbQROGMYdV2%2Fimage.png?alt=media&#x26;token=f7796664-aab8-424c-be33-602801098df5" alt=""><figcaption><p>Click the time to edit using the keyboard</p></figcaption></figure>

{% hint style="info" %}
In many cases where time units are used, a value in seconds is assumed unless otherwise specified. It may be helpful to display Seconds mode in the Timeflow view to select and copy specific times relating to a marker or keyframe.
{% endhint %}

## Current Time

Displays the current time in the timeline, displayed in the format selected. This can be changed manually to jump to another time. This corresponds to the playhead marker in the view shown below (orange wedge).

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FQGRxw1Unrzzh2bdBcUu9%2Fimage.png?alt=media&#x26;token=32e5f76d-62f5-47ea-9ec8-f0a2c9944fa2" alt=""><figcaption><p>Click and drag the playhead to set the current time, or click anywhere in the time ruler bar to jump to another time.</p></figcaption></figure>

## Start Time

Sets the beginning time of the timeline. This value is usually 0 though can be set to any value desired. This can also be used to globally (and non-destructively) insert or remove time from the beginning of existing animations.

## Play From Start

Enable this setting to ensure that Timeflow always begins playing from the beginning of the timeline when in play mode or running in a build. In most cases this value should remain enabled. Otherwise if disabled, then playback starts from the current time.

## End Time

This sets the ending time of the timeline.&#x20;

{% hint style="warning" %}
Timeflow requires a minimum duration of 1 second, therefor the smallest allowed value for End Time is Start Time + 1 second;&#x20;
{% endhint %}

## Play Past End

If this option is enabled, playback continues beyond the end of the timeline indefinitely. Use this option if you have procedural or looping behaviors you wish to extend. Alternatively, if this option is off then playback will stop when it reaches the end, or loop if looping is enabled.

{% hint style="warning" %}
Play Past End is only applicable when looping is off.&#x20;
{% endhint %}

## Duration

This sets the total time of the timeline, with a minimum value of 1 second.&#x20;

{% hint style="info" %}
Timeflow has a maximum duration of 100,000 seconds, which offers more than 27 hours of continuous play. This limit is to avoid potential issues with UI drawing. Generally it is advised to avoid such long durations unless needed for special circumstances.
{% endhint %}

### Lock Duration

The total duration may be locked to prevent accidental changes and disables dragging of the end time indicator in the Timeflow view.

### Match Audio

When an [Audio Track](https://axongenesis.gitbook.io/timeflow/reference/behaviors/audio/audio-track) is assigned, use this button to set the Timeflow duration to match the audio clip length.

### Fit to Displayed Objects

Press this button to set the start and end time to match the currently displayed objects in view. This takes into account all keyframes and tracks displayed. This can be helpful to discover any animation data that has ended up outside of the original time range.

{% hint style="info" %}
**Keyframes out of range**

Once keyframes or tracks have been moved outside of the current time range, they are no longer accessible in the view since scrolling prohibits going beyond the timeline duration.&#x20;

An easy workaround is to change the Start Time and End Time as needed to view more time in either direction, or use Fit to Displayed Objects. The start, end, and duration can safely be changed at any time without adversely affecting existing animations.
{% endhint %}

## Enable Looping

Enables or disables looping. If the [Work Area](https://axongenesis.gitbook.io/timeflow/user-guide/timeflow-view/toolbar/work-areas) is active, then the specified region of time is looped, otherwise the full duration is looped.&#x20;

{% hint style="info" %}
Looping can be used with or without the Work Area enabled
{% endhint %}

## Allow Replay

This option is enabled by default and allows Timeflow to restart at the beginning if Play() is invoked at the end of the time range. Unlike looping which replays repeatedly, Allow Replay plays just once through and stops at the end until retriggered by a play event. The animation can still be paused and resumed normally partway through if needed. This option generally matches users expectation that once an animation is played to the end, it can be played again by pressing the play button.

If this option is turned off, the current time will remain fixed at the end time and will not restart automatically even if a play event is triggered. To replay any prior segment will require setting the time by an event or script action.

{% hint style="info" %}
If scripting, you can use Timeflow\.Active.Play(true) to force playback to restart at the beginning. The beginning may be defined by the active Time Scope, Work Area, or Timeflow start time. For advanced playback control see [timeflow-controller](https://axongenesis.gitbook.io/timeflow/reference/timeflow-controller "mention")
{% endhint %}

## Local Time Scale

This multiplies the speed of the Timeflow instance and affects the playback rate of all animations within it. This is the same as setting [#time-scale](https://axongenesis.gitbook.io/timeflow/user-guide/update-settings#time-scale "mention") in Update Settings.

{% hint style="info" %}
Local time scale can be set to counteract the global time scale. For example, if you want the global time scale to be 2, you can set the Timeflow local time scale to 0.5 so that it plays at 1:1 in real time.&#x20;
{% endhint %}

## Global Time Scale

When enabled, this sets [Time.timeScale](https://docs.unity3d.com/ScriptReference/Time-timeScale.html), affecting the scene globally. This value can be used to create special timing effects such as slower or faster motion, affecting all timing globally.

{% hint style="info" %}
Since Time.timeScale is a global value, the checkbox ensures that it is set intentionally, only by those Timeflow instances that have it enabled.
{% endhint %}

## BPM

This defines music timing as beats per minute. When using a soundtrack and/or synchronizing to music, set the BPM to match the audio track. To view musical timing select the Measures format. This can also be set for the grid display.&#x20;

{% hint style="warning" %}
Timeflow prohibits directly animating its own properties such as BPM since it can cause unexpected behaviors. If BPM needs to change over the course of an animation, this could be accomplished through a script and an example is included in the examples.\
Assets/AxonGenesis/Timeflow/Samples/Demo/Scenes/AudioMidi/BPMControl
{% endhint %}

## FPS

This sets the target number of frames per second, which acts as the basis of timing. This works in conjunction with the [Timeflow Preferences](https://axongenesis.gitbook.io/timeflow/user-guide/menus-and-shortcuts/preferences) to determine the time tolerance (i.e. the smallest discreet unit of time for setting keyframes).&#x20;

{% hint style="info" %}
The FPS setting by itself does not impose a limit on the actual framerate rendered during runtime unless configured to do so in the [Update Settings](https://axongenesis.gitbook.io/timeflow/user-guide/timeflow-editor/update-settings).
{% endhint %}

## Custom Grid Time Increment

Overrides the grid and snap spacing using a custom time interval.&#x20;

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FHmJE7wJ4XgAqNr8JBYHx%2Fimage.png?alt=media&#x26;token=1324fe28-7375-450a-ad78-5cbb841fb32a" alt=""><figcaption><p>An example using a Custom Grid Time Increment of 1.5 seconds</p></figcaption></figure>

## Auto Play

When enabled, Timeflow starts playing immediately upon start. This may be turned off to start playback using user input, a trigger, or some other game logic. &#x20;

### Startup Frame Buffer

This determines how many frames are rendered before auto play begins. This effectively causes playback to wait until the scene has initialized. This avoids playback skipping when loading a scene that takes more than 1 frame to initialize.

{% hint style="info" %}
It is recommended to set the Startup Frame Buffer to a value of 3, though may be adjusted based on individual scene performance.
{% endhint %}

## Audio

An audio soundtrack may optionally be assigned to synchronize the scene to audio or music. Please see the [Audio Track](https://axongenesis.gitbook.io/timeflow/reference/behaviors/audio/audio-track) documentation for more information.

#### Create Audio Track

Click this button to generate a new [Audio Track ](https://axongenesis.gitbook.io/timeflow/reference/behaviors/audio/audio-track)game object with the required components and assigned to Timeflow.&#x20;

{% hint style="warning" %}
Be sure to assign an audio clip after creating the track by dragging and dropping and audio file from the Project view into the audio clip field.
{% endhint %}

{% hint style="success" %}
For longer or large audio files, it is recommended to set the import settings [Load Type](https://docs.unity3d.com/Manual/class-AudioClip.html) to Streaming to minimize memory usage. However, this is not required and any setting may be used at your discretion.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://axongenesis.gitbook.io/timeflow/user-guide/timeflow-editor/time.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
