> For the complete documentation index, see [llms.txt](https://docs.engagevr.io/developer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.engagevr.io/developer/afx/networking-afx/network-state-modules.md).

# Network State Modules

Network State Modules are scripts that manage the synchronization of objects and values between multiple users in an ENGAGE session. The most commonly used Network State Modules are as follows:

* Network State Module\_Transform
* Network State Module\_AFX Bool
* Network State Module\_AFX Float
* Network State Module\_AFX Int

In each case, you add a reference to a transform object or a variable component to the Network State Module, and then the module ensures that the referenced object or component is synchronized between all users.

## Using the transform Network State Module

You can use a `Network State Module_Transform` script to synchronize object transformations between multiple users in an ENGAGE session. A single module can synchronize multiple transforms.

<figure><img src="https://2640392766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5yxYHsXtlAaoMUrDWhLm%2Fuploads%2Fgit-blob-b6051786e568948c0ae37093f9206c66f56de1f8%2Fnetwork_state_module_trans.png?alt=media" alt=""><figcaption><p>A Network State Module_Transform script configured to synchronize the transform in the local game object</p></figcaption></figure>

To use a `Network State Module_Transform` script, complete the following steps:

1. Select a game object. This game object can include one of the transforms that you want to synchronize, but it isn't a requirement.
2. In the **Inspector** panel, add a `Network State Module_Transform` script.
3. **Optional**: If the game object will be included in a location, enter a value in the **Unique ID** field. The value must be unique within the Unity scene.
4. **Optional**: If you want changes to the transforms to be include in recordings, select the **Recordable** check box.
5. For each transform that you want to synchronize, complete the following steps:
   1. In the **Transforms** list, select the plus symbol to add a new item.
   2. Configure the settings as required. For more information, see [#transform-network-state-module-settings](#transform-network-state-module-settings "mention").
   3. Drag the game object that you want to synchronize a transform for onto the **Transform** field.
6. **Optional**: If the game object will be part of an IFX, complete the additional steps described in [#using-network-state-modules-in-ifx](#using-network-state-modules-in-ifx "mention").

### Transform Network State Module settings

The following settings are available for each transform that you want to synchronize.

<table><thead><tr><th width="190">Setting</th><th>Description</th></tr></thead><tbody><tr><td>Interpolate</td><td>If selected, when the ENGAGE application receives a new transform object from the network, it will perform a linear interpolation from the old transform values to the new values over multiple frames.<br><br>If cleared, the new transform values immediately replace the old values.<br><br>We recommend that you always select this value so that transitions are more smooth and natural.</td></tr><tr><td>Network Sensitivity</td><td>Leave at the default value.</td></tr><tr><td>Network Position</td><td>If selected, the position component of the transform is synchronized across the network.</td></tr><tr><td>Network Rotation</td><td>If selected, the rotation component of the transform is synchronized across the network.</td></tr><tr><td>Network Scale</td><td>If selected, the scale component of the transform is synchronized across the network.</td></tr><tr><td>Transform</td><td>Reference to the transform that you want to synchronize.</td></tr></tbody></table>

## Using a variable component Network State Module

The Boolean, integer, and float versions of Network State Module scripts have a similar structure and usage. You can use them to synchronize the value stored in a variable component between multiple users in an ENGAGE session. A single module can synchronize multiple variable components of the same type.

<figure><img src="https://2640392766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5yxYHsXtlAaoMUrDWhLm%2Fuploads%2Fgit-blob-0ec4e6375d9ec7ffdfa550c7cbf7678892c70624%2Fnetwork_state_module_var.png?alt=media" alt=""><figcaption><p>A Network State Module_AFX Float script configured to synchronize the float component on the same game object</p></figcaption></figure>

To use a variable component network state module script, complete the following steps:

1. Select a game object. This game object can include one of the variable components that you want to synchronize, but it isn't a requirement.
2. In the **Inspector** panel, add the required network state module script. You can choose either a Boolean, integer, or float version.
3. **Optional**: If the game object will be included in a location, enter a value in the **Unique ID** field. The value must be unique within the Unity scene.
4. **Optional**: If you want values changes to be include in recordings, select the **Recordable** check box.
5. For each variable component that you want to synchronize, complete the following steps:
   1. In the **Afx \<type>** list, select the plus symbol to add a new item.
   2. Drag the game object that includes the variable component onto the **Element** field.
6. **Optional**: If the game object will be part of an IFX, complete the additional steps described in [#using-network-state-modules-in-ifx](#using-network-state-modules-in-ifx "mention").

## Using Network State Modules in IFX

If you use Network State Module scripts to synchronize objects or values in IFX, complete the following additional steps:

1. Add an `IFX Network States Effect` script to the root game object in the IFX.
2. In the **Network State Modules** list of the `IFX Network States Effect` script, add a reference to each Network State Module used in the IFX.

The following image shows an example configuration:

<figure><img src="https://2640392766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5yxYHsXtlAaoMUrDWhLm%2Fuploads%2Fgit-blob-0ba691eeb9e8a814b4763a5cb278b96695dbcb87%2Fnetwork_module_ifx_example.png?alt=media" alt=""><figcaption><p>Example arrangement of network state modules in an IFX</p></figcaption></figure>
