Unity Networking Flashcards
What is HLAPI?
High Level API - it provides simple and secure client/server network model
What does the Network Manager do?
This Network Manager can control the state of a Multiplayer project, including game state management, spawn management, scene management, matchmaking and allowing access to debugging information.
What function is a good place to do initialization that is only for the local player, such as configuring cameras and input?
OnStartLocalPlayer
What class should a script using network functions derive from?
NetworkBehaviour rather than MonoBehaviour.
What namespace does a script need to use network functions?
UnityEngine.Networking
How would you add a check to see if gameobject is linked to the local player?
isLocalPlayer
What component would you add to a gameobject to keep it’s position in sync with the server?
a NetworkTransform
How do you speed up the server updating rate on an object that is randomly changing position?
Increase the Network Speed Rate on the NetworkTransform
What component controls an object’s network identity?
NetworkIdentity
How do you add a new prefab that will be spawned sometime in the future?
With the NetworkManager selected, add the prefab to a new row in the Registered Spawnable Prefabs list.
How do you indicate that a function will be called by the Client, but will be run on the Server?
By adding the [Command] attribute before the function
When making a networked command, what must the function name begin with?
“Cmd”
What does “Spawn” mean in regards to Multiplayer Networking HLAPI?
It means to create a GameObject on the Server and on all of the Clients connected to the Server. The GameObject will then be managed by the spawning system; state updates are sent to Clients when the object changes on the Server
How do you “spawn” a gameobject?
NetworkServer.Spawn(gameobject);
How would you make important variables such as player health and damage network aware and working under Server authority?
By using State Synchronization and a special member variable on networked objects called SyncVars