Netcode for GameObjects

Introduction

The Status Effect Framework now supports Unity's Netcode for GameObjectsarrow-up-right package. This means it will be possible to synchronize Status Effects from servers to clients with ease. Just note that the system is server authoritativearrow-up-right, and all logic related to StatusVariables should ideally only run on the server.

circle-exclamation

Getting Started

To begin syncing Status Effects, simply add a NetworkStatusManager to an object that can recieve StatusEffects. If upgrading a GameObject already using regular StatusManagers, you can still add a NetworkStatusManager as under the hood it will function identically. One thing to note is that all StatusEffects are automatically added to the .

In addition to adding the NetworkStatusManager, make sure that the GameObject also has a NetworkObjectarrow-up-right component attached. Status Effects will not sync if you do not add this.

Network Status Variables

In addition to the new NetworkStatusManager there are also a few classes that can replace the previous non-networked StatusVariables: NetworkStatusFloat, NetworkStatusInt, and NetworkStatusBool. The only difference between the NetworkStatusVariable and regular StatusVariables is that the base value and sign protected value will automatically sync across the network. There is a caveat to this however. Since StatusVariables are capable of being nested inside other classes or in arrays and lists, NetworkStatusVariables cannot. Similar to the base NetworkVariablearrow-up-right class, all NetworkStatusVariables must be in a NetworkBehaviourarrow-up-right and cannot be nested within anything. Again, make sure that the GameObject with the NetworkBehaviourarrow-up-right also has a NetworkObjectarrow-up-right component.

circle-info

Good to know: If you still want to use non-networked StatusVariables, you can still use the NetworkStatusManager in its SetManager method.

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.

Last updated