Mirror/docs/Classes/Attributes.md
Chris Langsenkamp 76b75dbb9b New Documentation (#184)
* Documentation Outline

* Spacing adjustments

* Captured old wiki content

* yml fix

* Docs work

* resize images

* Replaced images

* Removed md from links

* Renamed Misty to Fizzy

* Captured Unity docs

* links cleanup

* clear links

* Cleanup and moved NetworkBehavior to Classes.

* added slashes to yml paths

* reverted slashes

* Fixes bad link

* Update Ignorance.md

This should be enough documentation for now, yeah?

* Localized images

* Update Ignorance.md

formatting updates

* Lots of Cleanup

* fix link

* Formatting

* fix code blocks

* Lots of content and cleanup

* fixed yml

* Added blank line

* Added spaces in titles

* tightened bullets

* Fixed bullet spacing

* Fixed more bullets

* unbolded content

* Cleanup and removal of empty pages
Updated README with links to docs pages

* Restored prior version

* Contributing

* Improvements to content

* lower case fix

* fix link

* renamed Contributions

* fixed link

* home page content

* Fixed Encoding

* Moved Why TCP

* Replaced Unity with Mirror

* Telepathy Description

* changed to h2

* Moved Sample down

* Removed dead links

* Copied Contributions
Added Test
Fixed h3's

* Fixed headings

* added to Test

* Fixed image alts and links

* fixed last alt
2018-12-26 16:07:24 -06:00

1.8 KiB

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
    Something about this
  • Server
    means don't allow a client to call that method (throws a warning or an error when called on a client).
  • ServerCallback
    Something about this
  • Client
    means don't allow a server to call that method (throws a warning or an error when called on the server).
  • ClientRpc
    The server uses an Rpc to run that function on clients.
  • ClientCallback
    Something about this
  • TargetRpc
    Something about this
  • 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. 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
    • NetworkInstanceId
    • NetworkHash128
    • GameObject with a NetworkIdentity component attached.
  • SyncVar
    SyncVars 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 GameObject if the GameObject has a NetworkIdentity attached to it. You can use hooks.
  • SyncEvent
    Something about this