docs.unity3d.com
    Show / Hide Table of Contents

    Class ClipAction

    Base class for a clip action. Inherit from this class to make an action that would react on selected clips after a menu click and/or a key shortcut.

    Inheritance
    Object
    ClipAction
    Namespace: UnityEditor.Timeline.Actions
    Syntax
    public abstract class ClipAction : object, IAction
    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.

    Examples

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

        [MenuEntry("Custom Actions/Sample clip Action")]
        public class SampleClipAction : ClipAction
        {
            public override ActionValidity Validate(IEnumerable<TimelineClip> clip)
            {
                return ActionValidity.Valid;
            }
    
            public override bool Execute(IEnumerable<TimelineClip> items)
            {
                Debug.Log("Test Action");
                return true;
            }
    
            [TimelineShortcut("SampleClipAction", KeyCode.K)]
            public static void HandleShortCut(ShortcutArguments args)
            {
                Invoker.InvokeWithSelectedClips<SampleClipAction>();
            }
        }

    Methods

    Execute(IEnumerable<TimelineClip>)

    Execute the action based on clips.

    Declaration
    public abstract bool Execute(IEnumerable<TimelineClip> clips)
    Parameters
    Type Name Description
    IEnumerable<TimelineClip> clips

    clips that the action will act on.

    Returns
    Type Description
    Boolean

    Returns true if the action has been correctly executed, false otherwise.

    Validate(IEnumerable<TimelineClip>)

    Defines the validity of an Action for a given set of clips.

    Declaration
    public abstract ActionValidity Validate(IEnumerable<TimelineClip> clips)
    Parameters
    Type Name Description
    IEnumerable<TimelineClip> clips

    The clips that the action will act on.

    Returns
    Type Description
    ActionValidity

    The validity of the set of clips.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023