# Message Behaviour

## Overview

This component creates Messages that are sent to the GameObject that holds the Animator that includes this behavior. This is very useful for enabling, disabling, or executing code while an animation is playing. It works exactly as [**Animations Events**](https://docs.unity3d.com/Manual/script-AnimationWindowEvent.html) with the difference that animation events require a receiver, and it will throw a console error if the message does not get received. Messages Behaviours does not require a receiver and it will send messages On Enter, On Exit, or a specific time of the animation.

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F6jmb9IzTrKgQBNBGrFRO%2Fimage.png?alt=media&#x26;token=561c3d59-4db9-49bf-bd6b-de6f6338da9d" alt=""><figcaption></figcaption></figure>

&#x20;By default, it uses the **`IAnimatorListener`** Interface to filter the messages that are sent to specific scripts.

You can Enable the Option **SendMessage()** to use the Unity SendMessage option instead.&#x20;

## Parameters

### Enter

Send messages using the On State Enter, to the Animator GameObject.

### Exit

Send messages using the On State Exit, to the Animator GameObject.

### Time

Send messages using the On State Update, at a specific time of the Animation, to the Animator GameObject.

### Children

When enabled, it will send messages also to all the Animator gameobject children.

### SendMessage()

When enabled, it will use the Unity **SendMessage** method instead of the **`IAnimatorListener`** Interface.

### Debug

Debug the Message behavior in the Console.

## Message

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FqBOg0i9M4g2F6RtSH3Dq%2Fimage.png?alt=media&#x26;token=0f65fce4-a596-47a7-94dd-d6c0c88390a4" alt=""><figcaption></figcaption></figure>

The different messages **On Enter, On Exit,** and **On Time,** will be sent. The different types of messages supported are:<br>

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FCphEW9meRlGgBlxQszhx%2Fimage.png?alt=media&#x26;token=2eabe5ac-3edf-42f3-903e-9652b26a6454" alt=""><figcaption></figcaption></figure>
