Documentation
Sample workflows and important notes to assist your experience with MADNET
Last updated
Sample workflows and important notes to assist your experience with MADNET
Last updated
MADNET uses the singleton design pattern. To access the current instance of NetworkManager, use NetworkManager.Instance
Create a new C# script in Unity and inherit NetworkBehavior
Movement code should be client-authoritative, while certain codes, such as validation of a task's completion, are best done on the server. Client and server communication is established with NetworkInvoke()
To invoke a function on all connected clients, call NetworkInvoke("FUNCTION_NAME", object[] parameters, bool includeOwner)
If includeOwner = true
, the function will be invoked again on the calling client
NetworkIdentity.isLocalPlayer
returns true for the current local client that has authority, useful for player control scripts where only the object with authority should respond
Attach to any GameObject
you wish to sync transform with.
Sync Options:
Position
Rotation
Scale
Register a prefab by adding it to NetworkManager
's registeredPrefabs
. You can get a GameObject's registered NetId
using GetRegisteredSpawnPrefabID(GameObject gameObject)
Player prefab is automatically registered when added to NetworkManager
's playerPrefab
field.