mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 19:10:32 +00:00
35fee94d56
* Moved doc files to docfx folder * load csproj * doc generation * Run docfx * Add docfx * Deploy docs to mirror-networking.com * use deploy phase * deploy whole generated site * Fixed the semantic release command * Is last \ required? * show debug log * using lftp for site deploy * Testing lftp * Show current folder * try -e command option * Show me the files * use plain ftp * use choco install instead of cinst * fix ssl certificate validation * fix username * Upload site to xmldocs folder * no need to archive docs * No need for debug output * Fix file permissions * show me .htaccess * Show me contents * Wipe out folder to fix permissions * Set file permissions * Fix file permissions * complete toc list * Migrated intro page * Remove old docs * Update link to docs * Add link to github * Only update docs for stuff in master * This is a powershell command * Update doc/articles/Concepts/Communications/RemoteActions.md * Update doc/articles/Concepts/VisibilityCustom.md * Update doc/articles/Concepts/Authority.md * Update doc/articles/Concepts/GameObjects/SpawnObjectCustom.md * Update doc/articles/Concepts/Authority.md * Update doc/articles/Classes/SyncVars.md * No need to run semver twice
49 lines
2.7 KiB
Markdown
49 lines
2.7 KiB
Markdown
# Attributes Overview
|
||
|
||
Networking attributes are added to member functions of NetworkBehaviour scripts, to make them run on either the client or server.
|
||
|
||
These attributes can be used for Unity game loop methods like Start or Update, as well as other implemented methods.
|
||
|
||
- **NetworkSettings**
|
||
This attribute has been deprecated because `channels` were moved to transports (where applicable) and `interval` was moved to an inspector property
|
||
|
||
- **Server**
|
||
means don't allow a client to call that method (throws a warning or an error when called on a client).
|
||
|
||
- **ServerCallback**
|
||
A Custom Attribute that can be added to member functions of NetworkBehaviour scripts, to make them only run on servers.
|
||
|
||
- **Client**
|
||
means don't allow a server to call that method (throws a warning or an error when called on the server).
|
||
|
||
- **ClientCallback**
|
||
A Custom Attribute that can be added to member functions of NetworkBehaviour scripts, to make them only run on clients, but not generate warnings.
|
||
|
||
- **ClientRpc**
|
||
The server uses a Remote Procedure Call (RPC) to run that function on clients. See also: [Remote Actions](../Concepts/Communications/RemoteActions.md)
|
||
|
||
- **TargetRpc**
|
||
This is an attribute that can be put on methods of NetworkBehaviour classes to allow them to be invoked on clients from a server. Unlike the ClientRpc attribute, these functions are invoked on one individual target client, not all of the ready clients. See also: [Remote Actions](../Concepts/Communications/RemoteActions.md)
|
||
|
||
- **Command**
|
||
Call this from a client to run this function on the server. Make sure to validate input etc. It's not possible to call this from a server. Use this as a wrapper around another function, if you want to call it from the server too. See also [Remote Actions](../Concepts/Communications/RemoteActions.md)
|
||
The allowed argument types are:
|
||
|
||
- Basic type (byte, int, float, string, UInt64, etc)
|
||
|
||
- Built-in Unity math type (Vector3, Quaternion, etc),
|
||
|
||
- Arrays of basic types
|
||
|
||
- Structs containing allowable types
|
||
|
||
- NetworkIdentity
|
||
|
||
- Game object with a NetworkIdentity component attached.
|
||
|
||
- **SyncVar**
|
||
[SyncVars](SyncVars.md) are used to synchronize a variable from the server to all clients automatically. Don't assign them from a client, it's pointless. Don't let them be null, you will get errors. You can use int, long, float, string, Vector3 etc. (all simple types) and NetworkIdentity and game object if the game object has a NetworkIdentity attached to it. You can use [hooks](SyncVarHook.md).
|
||
|
||
- **SyncEvent**
|
||
[SyncEvent](SyncEvent.md) are networked events like ClientRpc's, but instead of calling a function on the game object, they trigger Events instead.
|