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
How do you indicate a variable is a Network synchronized variable?
By adding [SyncVar] before the variable
How do you check if script is being run on the server?
isServer
How would you call a function on the Server, but execute it on the Clients?
Make the function into a ClientRpc call, use the [ClientRpc] attribute and add “Rpc” as a prefix to the name of the function.
How do you set a gameobject to be a potential spawn point?
By adding a NetworkStartPosition component
How do you sync a gameobject’s animations with the server?
by adding a NetworkAnimator
What does it mean to run a server in “headless mode”?
A headless system is a computer that operates without a monitor, graphical user interface (GUI) or peripheral devices, such as keyboard and mouse.
How do you set a gameobject’s visibility to only be visible within a player’s “area of interest”?
By adding a NetworkProximityChecker
When does the server update SyncVar values to clients?
SyncVar updates are sent automatically by the server to all the clients when the value of a SyncVar changes on the server.
Do SyncVars that change on the client automatically change on the server?
No, SyncVars update to the clients from the server