# 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="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Ft8EDbfxHE42L7Bfqv5pp%2Fimage.png?alt=media&#x26;token=bcfde9bb-bdad-4b6b-aaf5-1a5d3af3beb6" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2Fz0pvVgaZ0ll0WoBNY5HD%2FUnity_63Px8HHlrL.gif?alt=media&#x26;token=c9d33ee7-6d9e-4f68-920b-0389ad9ca74c" alt=""><figcaption></figcaption></figure>

## **Effect Parameters**

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2FW9k11Cl5qIWJHRF7wekt%2Fimage.png?alt=media&#x26;token=5f79423c-945f-448b-8310-e9c9cdbfa370" 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**

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-LzldnMdcE0yyUMtiyLv%2F-Lzm1I1rtIRA7X2lRmVR%2Fimage.png?alt=media\&token=3dcc7199-960e-4f8c-9227-359d1e64f362)

### **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)  
```
