docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TimelineAction

    Base class for a timeline action. Inherit from this class to make an action on a timeline after a menu click and/or a key shortcut.

    Inheritance
    object
    TimelineAction
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEditor.Timeline.Actions
    Assembly: Unity.Timeline.Editor.dll
    Syntax
    [ActiveInMode(TimelineModes.Default)]
    public abstract class TimelineAction
    Remarks

    To add an action as a menu item in the Timeline context menu, add MenuEntryAttribute on the action class. To make an action to react to a shortcut, use the Shortcut Manager API with TimelineShortcutAttribute. ShortcutAttribute ActiveInModeAttribute

    Examples

    Simple Timeline Action example (with context menu and shortcut support).

    [MenuEntry("Custom Actions/Sample Timeline Action")]
    public class SampleTimelineAction : TimelineAction
    {
        public override ActionValidity Validate(ActionContext context)
        {
            return ActionValidity.Valid;
        }
    
        public override bool Execute(ActionContext context)
        {
            Debug.Log("Test Action");
            return true;
        }
    
        [TimelineShortcut("SampleTimelineAction", KeyCode.Q)]
        public static void HandleShortCut(ShortcutArguments args)
        {
            Invoker.InvokeWithSelected<SampleTimelineAction>();
        }
    }

    Methods

    Execute(ActionContext)

    Execute the action.

    Declaration
    public abstract bool Execute(ActionContext context)
    Parameters
    Type Name Description
    ActionContext context

    Context for the action.

    Returns
    Type Description
    bool

    true if the action has been executed. false otherwise

    Validate(ActionContext)

    Defines the validity of an Action based on the context.

    Declaration
    public abstract ActionValidity Validate(ActionContext context)
    Parameters
    Type Name Description
    ActionContext context

    Context for the action.

    Returns
    Type Description
    ActionValidity

    Visual state of the menu for the action.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)