Legacy Documentation: Version 2018.1 (Go to current version)
Network Transform Visualizer
NetworkBehaviour
Other Versions

Multiplayer Classes Reference

You can create scripts which inherit from these classes to customise the way Unity’s networking works.

  • The NetworkBehaviour class works with GameObjects that have a Network Identity component. These scripts can perform high-level API functions such as Commands, ClientRPCs, SyncEvents and SyncVars.
  • The NetworkClient class manages a network connection from a client to a server, and can send and receive messages between the client and the server.
  • The NetworkConnection encapsulates a network connection. (NetworkClient)[class-NetworkClient] objects have a NetworkConnection, and NetworkServers have multiple connections - one from each client. NetworkConnections have the ability to send byte arrays, or serialized objects as network messages.
  • The NetworkServer manages connections from multiple clients, and provides game-related functionality such as spawning, local clients, and player manager.
  • The NetworkServerSimple is a basic server class with no game-related functionality. While the NetworkServer class handles game-like things such as spawning, local clients, and player manager, and has a static interface, the NetworkServerSimple class is a pure network server with no game related functionality. It also has no static interface or singleton, so more than one instance can exist in a process at a time.
对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答