# 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="/files/UOYEGe7gkoz4FbOdFxpd" 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="/files/BKZVgp5Sx5bejB73ZfQ6" 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="/files/0qTYQUoHgZGTQg5xscpC" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://malbersanimations.gitbook.io/animal-controller/global-components/animator-behaviours/message-behaviour.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
