# Network State

### **Network Property** <a href="#network-property" id="network-property"></a>

A Network Property is a C# property which is replicated across the network. For a property to be networked, the Attribute \[Networked] must be added to it. An example of a networked property:

```csharp
[Networked]
public int Health {get; set;}
```

Supported C# Types

1. Int/UInt
2. Float
3. Bool
4. String
5. Enums
6. Byte
7. Long/ULong
8. Double

Supported Unity Types:

1. Vector2
2. Vector3
3. Quaternion
4. Color

### Network Arrays

Network arrays are just like regular C# arrays, but their syntax is a bit different. They are defined using the NetworkArray generic class.

Example of a network array:

```csharp
[Networked (size: 10)] public NetworkArray Items { get; set; }
```

### **Custom Networked Structs** <a href="#custom-networked-structs" id="custom-networked-structs"></a>

You can define custom structs that can be networked/replicated by adding the attribute \[Networked] to them, like this:

```csharp
[Networked]
public struct Inventory
{
    public int Item1;
    public int Item2;
}
```

Important notes:

{% hint style="info" %}
**1.** It’s important to make sure that a single struct doesn’t exceed the maximum property size, which is 50 bytes.\
**2**. Structs must not include other user-defined networked structs, only C#’s and Unity’s primitive types.\
**3**. You might want to override/implement equality for the struct for better performance.
{% endhint %}
