> For the complete documentation index, see [llms.txt](https://maraudical.gitbook.io/status-effects-framework/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://maraudical.gitbook.io/status-effects-framework/other-support/netcode-for-gameobjects.md).

# Netcode for GameObjects

<figure><picture><source srcset="/files/fMRYzHXLY7pwdmq31M71" media="(prefers-color-scheme: dark)"><img src="/files/B2yZTl5HfuFSGMAA6Ii4" alt="" width="192"></picture><figcaption></figcaption></figure>

## Introduction

The Status Effect Framework now supports Unity's [Netcode for GameObjects](https://docs.unity3d.com/Manual/com.unity.netcode.gameobjects.html) package. This means it will be possible to synchronize Status Effects from servers to clients with ease. Just note that the system is [server authoritative](https://docs.unity.com/ugs/en-us/manual/cloud-code/manual/server-authority), and all logic related to [StatusVariables](/status-effects-framework/type-specifics/classes/statusvariable.md) should ideally only run on the server.

{% hint style="warning" %}
[Netcode for GameObjects](https://docs.unity3d.com/Manual/com.unity.netcode.gameobjects.html) must use version 1.8 or newer!
{% endhint %}

## Getting Started

To begin syncing Status Effects, simply add a **NetworkStatusManager** to an object that can recieve [StatusEffects](/status-effects-framework/type-specifics/classes/statuseffect.md). If upgrading a GameObject already using regular [StatusManagers](/status-effects-framework/type-specifics/classes/statusmanager.md), you can still add a **NetworkStatusManager** as under the hood it will function identically. One thing to note is that all [StatusEffects](/status-effects-framework/type-specifics/classes/statuseffect.md) are automatically added to the .

In addition to adding the NetworkStatusManager, make sure that the GameObject also has a [NetworkObject](https://docs-multiplayer.unity3d.com/netcode/current/basics/networkobject/) component attached. <mark style="color:red;">**Status Effects will not sync if you do not add this**</mark>.

## Network Status Variables

In addition to the new NetworkStatusManager there are also a few classes that can replace the previous non-networked  [StatusVariables](/status-effects-framework/type-specifics/classes/statusvariable.md): **NetworkStatusFloat**, **NetworkStatusInt**, and **NetworkStatusBool**. The only difference between the NetworkStatusVariable and regular [StatusVariables](/status-effects-framework/type-specifics/classes/statusvariable.md) is that the base value and sign protected value will automatically sync across the network. There is a caveat to this however. Since [StatusVariables](/status-effects-framework/type-specifics/classes/statusvariable.md) are capable of being nested inside other classes or in arrays and lists, NetworkStatusVariables cannot. Similar to the base [NetworkVariable](https://docs-multiplayer.unity3d.com/netcode/current/basics/networkvariable/) class, <mark style="color:red;">**all NetworkStatusVariables must be in a**</mark> [<mark style="color:red;">**NetworkBehaviour**</mark>](https://docs.unity3d.com/2020.1/Documentation/Manual/class-NetworkBehaviour.html) <mark style="color:red;">**and cannot be nested within anything**</mark>. Again, make sure that the GameObject with the [NetworkBehaviour](https://docs.unity3d.com/2020.1/Documentation/Manual/class-NetworkBehaviour.html) also has a [NetworkObject](https://docs-multiplayer.unity3d.com/netcode/current/basics/networkobject/) component.

{% hint style="info" %}
**Good to know:** If you still want to use non-networked [StatusVariables](/status-effects-framework/type-specifics/classes/statusvariable.md), you can still use the NetworkStatusManager in its [SetManager](/status-effects-framework/type-specifics/classes/statusvariable/setmanager.md) method.
{% endhint %}

Thats it! If you have other questions or find any bugs feel free to send me a message on Discord or add it to the issue tracker on GitHub.
