Animatables
  • đŸ•šī¸Getting Started
    • Introducing Animatables
    • Installation
    • Components
      • Animation Data
      • Animation Manager
        • Animation Curve Presets
      • Animatable Transform
      • Animatable UI Objects
    • Easing Curves
  • 📄Scripting Basics
    • Animation Registry
    • Creating Animations
      • Animation Creator
      • Animating Numbers
      • Animating Colors
      • Animating Transform
      • Animating Rect Transform
      • Easing Animations
    • Getting Animations
    • Add or Remove Animations
    • Editing Animations
    • Events
  • đŸ› ī¸Support
    • Getting Help
    • Contact
  • 📚Changelogs
    • Latest Releases
Powered by GitBook
On this page
  • Main Method
  • On Start
  • On Update
  • On Complete
  • Alternative Method
  • On Start
  • On Update
  • On Complete
  • Remove All
  1. Scripting Basics

Events

Each animation has 3 events. You can add or remove events from an animation at any time.

Main Method

The main method of adding events is generally faster.

On Start

animation.OnStart(() => { Debug.Log("test"); });

On Update

animation.OnUpdate(() => { Debug.Log("test"); });

On Complete

animation.OnComplete(() => { Debug.Log("test"); });

Alternative Method

Optionally, you can opt for a different method of adding events that may make removing them easier.

On Start

Add Event

Action action = () => { Debug.Log("test"); };
animation.onStart.AddListener(action.Invoke);

Remove Event

animation.onStart.RemoveListener(action.Invoke);

On Update

Add Event

Action action = () => { Debug.Log("test"); };
animation.onUpdate.AddListener(action.Invoke);

Remove Event

animation.onUpdate.RemoveListener(action.Invoke);

On Complete

Add Event

Action action = () => { Debug.Log("test"); };
animation.onComplete.AddListener(action.Invoke);

Remove Event

animation.onComplete.RemoveListener(action.Invoke);

Remove All

You can call UnityEvent.RemoveAllListeners to remove all event listeners.

animation.onStart.RemoveAllListeners();
PreviousEditing AnimationsNextGetting Help

Last updated 12 months ago

📄