Networking

Behavior Designer supports Unity’s networking system UNET introduced with Unity 5.1. Networking is a complex topic so it is highly recommended that you first go through Unity’s networking documentation before continuing. Note: UNET has been deprecated in current versions of Unity. This guide is for those using older Unity versions.

Shared Variables can automatically be synchronized over the network from the server to the client. This can be enabled by opening the details of the variable and selecting “Network Sync”:

The ENABLE_MULTIPLAYER compiler definition must be added for the variables to sync correctly.

Due to a current networking limitation, ClientRPC calls cannot be overloaded so the type has to be known ahead of time. This means that only the following types of variables can be synchronized:

  • bool
  • Color
  • float
  • GameObject
  • int
  • Quaternion
  • Rect
  • string
  • Transform
  • Vector2
  • Vector3
  • Vector4

The Behavior component from the runtime source code must be used in order to allow the variables to be synchronized. This is a result of a current Unity networking bug. ClientRPC calls cannot be called on the parent class from a subclass. A bug report has been submitted and are waiting for a fix. This bug manifests itself by displaying the following warning in the console:

Failed to invoke RPC [RpcPath]([ObjectID]) on netID [NetID]

Where [RpcPath] is the method path, [ObjectID] is the ID of the object, and [NetID] is the network ID.