Prefabs
Tips and best practices for using prefabs with Timeflow
Last updated
Tips and best practices for using prefabs with Timeflow
Last updated
Use Unity's built-in prefab system to create reusable assets, including Timeflow behaviors and animations! Just as with any prefab, overrides may be used to customize prefab instances.
If you're new to working with prefabs, please refer to the Unity documentation.
To create a prefab, simply select a game object in the Hierarchy view, and drag and drop it into your Project view, which you may place into any directory for organization.
The item turns blue indicating it is now a prefab object.
Use the keyboard shortcut Control + Alt + Shift + S to 'Save Selected Prefabs'.
If the selected object(s) is not a prefab instance, a new prefab is created in the Prefab Save Path designated in the preferences.
If the object is a prefab instance, saving it applies all overrides made in the scene to the prefab. This is the same as selected Apply All from the Overrides menu.
In the Timeflow view, prefab instances are shown with a blue label color, matching how they are displayed in the built-in Hierarchy view.
You may also use the keyboard shortcut Control + Enter to open any selected prefab or precomp in the scene.
Prefabs are automatically displayed using Local Time Scope.
When a prefab is open for editing, a blue line is drawn across the toolbar as a visual queue to indicate that prefab mode is active.
Precomps can also be made into prefabs, though precomposing is not required and prefabs can be made from any group of objects.
To open a prefab for editing in the Timeflow view, you must either have a scene open with an active Timeflow instance, or the prefab must be a precomp containing a Timeflow instance.
You may also use the keyboard shortcut Control + Minus to exit prefab mode, which will prompt you to save any unsaved changes.
Disable Auto Save
To improve performance while working with prefabs it is highly recommended to disable the Auto Save setting in prefab mode. This option can be found in the Scene view while a prefab is open for editing.
Place in time using Drag Time Offset
If you have an animated object or hierarchy of objects in a prefab that you wish to sequence instances of in Timeflow, it is best to use Time Offset. This allows you to place the object track anywhere in time without changing the timing of animation keyframes within it. For the best user experience, enabling Drag Time Offset is recommended.
Drag prefabs directly into Timeflow
You can drag prefab objects directly from the Project view into the Timeflow view. Just as when drag-dropping a prefab into the Hierarchy view, a new prefab instance is created in the scene.
If any component inside a prefab performs reparenting as part of its animation or behavior, this will result in the warning above.
Solution: The prefab must be unpacked, or an alternate approach is needed that does not require reparenting. For virtual parenting without affecting the hierarchy, see Follow
To unpack a prefab, right-click on it in the hierarchy view and select from the context menu Prefab/Unpack. If the prefab is comprised of other prefabs, the entire hierarchy can be unpacked using Unpack Completely.
The prefab instance may be edited directly in the Timeflow view, which will create overrides for any changes. Or if you wish to edit the prefab directly, click the small arrow icon to the right of the object name to open the prefab asset. This same behavior is also used with Precomposing
Once you are finished editing a prefab, you may close and save the prefab using any of the built-in methods, or in the Timeflow view click the arrow button in the upper left corner. The view will then return to the current scene, first prompting to save any changes.