mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
docs: Added video tutorial URL (#1308)
* Update SyncVars.md * Update doc/Guides/Sync/SyncVars.md Co-Authored-By: Paul Pacheco <paulpach@gmail.com> * Update SyncVars.md - Removed starting time from video URL. * Resize image and move to the top * Make video bigger
This commit is contained in:
parent
f21dbfee01
commit
3033ed7541
@ -1,5 +1,7 @@
|
||||
# SyncVars
|
||||
|
||||
[<img alt="Video Tutorial" src="https://img.youtube.com/vi/T7AoozedYfI/0.jpg" width="200">](https://www.youtube.com/watch?v=T7AoozedYfI)
|
||||
|
||||
SyncVars are properties of classes that inherit from NetworkBehaviour, which are synchronized from the server to clients. When a game object is spawned, or a new player joins a game in progress, they are sent the latest state of all SyncVars on networked objects that are visible to them. Use the `SyncVar` custom attribute to specify which variables in your script you want to synchronize.
|
||||
|
||||
The state of SyncVars is applied to game objects on clients before `OnStartClient()` is called, so the state of the object is always up-to-date inside `OnStartClient()`.
|
||||
@ -11,7 +13,6 @@ The server automatically sends SyncVar updates when the value of a SyncVar chang
|
||||
> The [SyncVar hook](SyncVarHook.md) attribute can be used to specify a method to be called when the SyncVar changes value on the client.
|
||||
|
||||
## SyncVar Example
|
||||
|
||||
Let's say we have a networked object with a script called Enemy:
|
||||
|
||||
``` cs
|
||||
|
Loading…
Reference in New Issue
Block a user