# 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

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

### On Update

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

### On Complete

```csharp
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

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

#### Remove Event

```csharp
animation.onStart.RemoveListener(action.Invoke);
```

### On Update

#### Add Event

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

#### Remove Event

```csharp
animation.onUpdate.RemoveListener(action.Invoke);
```

### On Complete

#### Add Event

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

#### Remove Event

```csharp
animation.onComplete.RemoveListener(action.Invoke);
```

## Remove All

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

```csharp
animation.onStart.RemoveAllListeners();
```
