# AddStatusEffect

### Declaration

public static [StatusEffect](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/classes/statuseffect) **AddStatusEffect**([StatusEffectData](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/scriptable-objects/statuseffectdata) statusEffectData)

### Parameters

<table data-header-hidden data-full-width="false"><thead><tr><th width="224"></th><th></th></tr></thead><tbody><tr><td>statusEffectData</td><td>The data that the new <a href="../statuseffect">StatusEffect</a> should use.</td></tr></tbody></table>

### Returns

[**StatusEffect**](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/classes/statuseffect) Returns the StatusEffect reference that was added to the [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html).

### Description

Adds a new [StatusEffect](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/classes/statuseffect) to a given [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html).

***

### Declaration

public static [StatusEffect](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/classes/statuseffect) **AddStatusEffect**([StatusEffectData](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/scriptable-objects/statuseffectdata) statusEffectData, float duration)

### Parameters

<table data-header-hidden data-full-width="false"><thead><tr><th width="224"></th><th></th></tr></thead><tbody><tr><td>statusEffectData</td><td>The data that the new <a href="../statuseffect">StatusEffect</a> should use.</td></tr><tr><td>duration</td><td>How long in seconds the effect should last.</td></tr></tbody></table>

### Returns

[**StatusEffect**](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/classes/statuseffect) Returns the StatusEffect reference that was added to the [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html).

### Description

Adds a new [StatusEffect](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/classes/statuseffect) to a given [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) for a duration of time.

***

### Declaration

public static [StatusEffect](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/classes/statuseffect) **AddStatusEffect**([StatusEffectData](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/scriptable-objects/statuseffectdata) statusEffectData, float duration, [UnityEvent](https://docs.unity3d.com/ScriptReference/Events.UnityEvent.html) unityEvent)

### Parameters

<table data-header-hidden data-full-width="false"><thead><tr><th width="224"></th><th></th></tr></thead><tbody><tr><td>statusEffectData</td><td>The data that the new <a href="../statuseffect">StatusEffect</a> should use.</td></tr><tr><td>duration</td><td>How long in seconds the effect should last.</td></tr><tr><td>unityEvent</td><td>The <a href="https://docs.unity3d.com/ScriptReference/Events.UnityEvent.html">UnityEvent</a> to subscribe the duration decrement to.</td></tr></tbody></table>

### Returns

[**StatusEffect**](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/classes/statuseffect) Returns the StatusEffect reference that was added to the [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html).

### Description

Adds a new [StatusEffect](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/classes/statuseffect) to a given [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) for a duration that decrements when the referenced [UnityEvent](https://docs.unity3d.com/ScriptReference/Events.UnityEvent.html) is invoked.

***

### Declaration

public static [StatusEffect](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/classes/statuseffect) **AddStatusEffect**([StatusEffectData](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/scriptable-objects/statuseffectdata) statusEffectData, [Func](https://learn.microsoft.com/en-us/dotnet/api/system.func-1?view=net-7.0)\<bool> predicate)

### Parameters

<table data-header-hidden data-full-width="false"><thead><tr><th width="224"></th><th></th></tr></thead><tbody><tr><td>statusEffectData</td><td>The data that the new <a href="../statuseffect">StatusEffect</a> should use.</td></tr><tr><td>predicate</td><td>When true the effect will end.</td></tr></tbody></table>

### Returns

[**StatusEffect**](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/classes/statuseffect) Returns the StatusEffect reference that was added to the [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html).

### Description

Adds a new [StatusEffect](https://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/classes/statuseffect) to a given [MonoBehaviour](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) that will be removed when the predicate is true.


---

# 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://maraudical.gitbook.io/status-effect-framework/1.4.0/type-specifics/classes/statusmanager/addstatuseffect.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.
