# Effect Manager

## Overview

This module stores a list of prefabs and gameObjects that you can instantiate, enable or disable during an animation.&#x20;

<figure><img src="/files/VjlFMihRe8qxG4g1Dx5q" alt=""><figcaption></figcaption></figure>

When you create a new Effect you will set the name and the ID parameters

<figure><img src="/files/rYsmWJuFlx1kQSvUw2d7" alt=""><figcaption></figcaption></figure>

## **Effect Parameters**

<figure><img src="/files/xC9pL54kJm9ZBvHIimOI" alt=""><figcaption></figcaption></figure>

### **Active**

Enable / Disable the Effect.

{% hint style="warning" %}
Disabled Effects will be ignored when the metho&#x64;**`PlayEffect(int ID)`**&#x69;s called
{% endhint %}

### **Name**

Name of the **Effect.** This parameter is used to enable or disable the Effects. Use it to&#x20;

### **ID**

Identifier for the **effect**. Is Used for Playing and Stopping an effect using PlayEffect  and StopEffect methods

### **Effect**

The **Prefab** or **GameObjects** holds the **Effect** (Particles, transforms).

### **Life**

Duration of the effect.&#x20;

If the **effect** is a prefab, it will be destroyed after the life duration has elapsed.

If the **effect** is not a prefab, it will be disabled after the life duration has elapsed.&#x20;

{% hint style="info" %}
If Life < 0 then The **effect** will not be destroyed by the Effect Manager.
{% endhint %}

### **Delay**

The time needed to elapse before starting to play the **Effect**.

### **Root**

Uses the Root transform as a reference to move the **Effect** to the root position.

### **Is Child**

Sets the **Effect** as a child of the **Root** transform.

### **Use Root Rotation**

Orient the effect using the root rotation.

### **Offsets**

Add additional offset to the effect position, rotation, and scal&#x65;**.**

### **Effect Modifier**

Scriptable object to modify the effect parameters before, during or after the effect plays. This is useful to pass parameters via script to the instantiated **Effect.** <br>

## **Events**

![](/files/-Lzm1I1rtIRA7X2lRmVR)

### **On Play Event**

Invoked when the effect plays.

### **On Stop Event**

&#x20;Invoked when the effect stops.

## Public Methods

These are the List of Public methods you can use via Unity Events or Script to call the functions of the Effect Manager:

```csharp
//Plays an Active Effect using its ID value
public void PlayEffect(int ID);
        OR
public void Effect_Play(int ID);
```

```csharp
//Stops a Playing Effect using its ID value
public void StopEffect(int ID) 
        OR
public void Effect_Stop(int ID)  
```

```csharp
//Enable an Effect using its ID
public void Effect_Enable(int ID)

//Enable an Effect using its Name
public void Effect_Enable(string name)  
```

```csharp
//Disable an Effect using its ID
public void Effect_Disable(int ID)

//Disable an Effect using its Name
public void Effect_Disable(string name)  
```


---

# 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/utilities/effect-manager.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.
