Skip to content

Commit 271218d

Browse files
committed
docs: Added documnetation for SyncedVar
1 parent 86b4979 commit 271218d

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

docs/_data/docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- object-behaviour-relation
1414
- modularity
1515
- networkedvar
16+
- syncedvar
1617
- scene-management
1718
- object-ownership
1819
- object-visibility

docs/_docs/the-basics/syncedvar.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: SyncedVar
3+
permalink: /wiki/syncedvar/
4+
---
5+
6+
SyncedVars are simple ways to have syncronized fields in NetworkedBehaviours. SyncedVars are similar to NetworkedVars but have a few differences:
7+
8+
1. They are slower
9+
2. They are less customizable
10+
3. They only sync from server to client
11+
4. They require less code
12+
5. They support serialization
13+
14+
### Example
15+
Creating a SyncedVar is as easy as creating an attribute on the field. Note that properties are not supported.
16+
17+
```csharp
18+
[SyncedVar]
19+
public float mySyncedFloat = 5f;
20+
```
21+
22+
### Single Sync Values
23+
If you want values to be synced only once (at spawn), the send rate can be set to a negative value.

0 commit comments

Comments
 (0)