0
0
Unityframework~10 mins

Why multiplayer requires networking in Unity - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to send a message to all players in a multiplayer game.

Unity
NetworkManager.Singleton.[1]("Hello players!");
Drag options to blanks, or click blank then click option'
ASendMessage
BBroadcastMessage
CSendToAllClients
DSendMessageToAll
Attempts:
3 left
💡 Hint
Common Mistakes
Using a method name that does not exist in NetworkManager.
Confusing client and server methods.
2fill in blank
medium

Complete the code to check if the current player is the server before sending data.

Unity
if (NetworkManager.Singleton.[1]) {
    // send data
}
Drag options to blanks, or click blank then click option'
AIsHost
BIsClient
CIsServer
DIsConnected
Attempts:
3 left
💡 Hint
Common Mistakes
Using IsClient instead of IsServer.
Confusing IsHost with IsServer.
3fill in blank
hard

Fix the error in the code to synchronize player positions over the network.

Unity
void Update() {
    if (NetworkManager.Singleton.[1]) {
        transform.position = GetNetworkPosition();
    }
}
Drag options to blanks, or click blank then click option'
AIsServer
BIsClient
CIsHost
DIsConnected
Attempts:
3 left
💡 Hint
Common Mistakes
Using IsServer which is for the server only.
Using IsHost which combines client and server roles.
4fill in blank
hard

Fill both blanks to create a dictionary of player scores only for players with scores above 10.

Unity
var highScores = {player: score for player, score in playerScores.items() if score [1] 10};
Drag options to blanks, or click blank then click option'
A==
B<
C!=
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using < which selects scores less than 10.
Using == which selects scores equal to 10.
5fill in blank
hard

Fill all three blanks to filter and transform player names with scores above 5.

Unity
filtered = { [1]: [2].upper() for [3], score in scores.items() if score > 5 }
Drag options to blanks, or click blank then click option'
Aname
Dplayer
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Not applying the uppercase transformation.