Core Concepts
Network Sandbox
Network Sandbox is what controls the whole network simulation. It can be thought of as the manager of the simulation. You can have more than one network sandbox in a single Unity game, and that happens when you start both a client and a server on the same project. This can be extremely useful for testing/debugging, because it allows you to run a server and a client (or multiple thereof) in the same project and therefore see what happens at both at the same time, without interference.
Therefore you can think of a sandbox as representing a server or a client.
You can show/hide the current sandboxes from the Network Sandboxes panel.
Network Object
Any GameObject which needs to be synced/replicated must be a Network Object (has the Network Object added to it). If you want to see something on everyone’s screen, it has to have a Network Object component added to it. It’s the component that tells Netick that a GameObject is networked. The Network Object component by itself just informs Netick that the object is networked. To add networked gameplay-logic to it, you must do so in a component of a class derived from Network Behavior. Netick comes with a few essential built-in components:
Network Transform: used to sync position and rotation
Network Rigidbody: used to sync controllable physical objects
Network Animator: used to sync Unity’s animator’s state
Network Behavior
The Network Behavior class is your old friend MonoBehaviour, just the networked version of it. To implement your networked functionality, just create a new class and derive it from NetworkBehavior. You have several methods you can override which correspond to Unity’s non-networked equivalents (they must be used instead of Unity’s equivalents when doing anything related to the network simulation):
NetworkStart
NetworkDestroy
NetworkFixedUpdate
NetworkUpdate
NetworkRender
Example:
Don’t forget to include using Netick
A class derived from Networked Behavior is almost useless without the utilization of Network Properties, which are the building blocks of your networked synced state. These properties are ensured to be eventually synced to everyone in the network, letting you create objects with complex states and not worry about it.
Last updated
Was this helpful?