NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Converting a single-player game to Unity Multiplayer
This document describes steps to converting a single player game to a multiplayer game, using the new Unity Multiplayer networking system. The process described here is a simplified, higher level version of the actual process for a real game; it doesn’t always work exactly like this, but it provides a basic recipe for the process.

NetworkManager set-up

Add a new GameObject to the Scene and rename it “NetworkManager”.
Add the NetworkManager component to the “NetworkManager” GameObject.
Add the NetworkManagerHUD component to the GameObject. This provides the default UI for managing the network game state.
See Using the NetworkManager.

Player Prefab set-up

Find the Prefab for the player GameObject in the game, or create a Prefab from the player GameObject
Add the NetworkIdentity component to the player Prefab
Check the LocalPlayerAuthority box on the NetworkIdentity
Set the playerPrefab in the NetworkManager’s Spawn Info section to the player Prefab
Remove the player GameObject instance from the Scene if it exists in the Scene
See Player Objects for more information.

Player movement

Add a NetworkTransform component to the player Prefab
Update input and control scripts to respect isLocalPlayer
Fix Camera to use spawned player and isLocalPlayer
For example, this script only processes input for the local player:

using UnityEngine;
using UnityEngine.Networking;

public class Controls : NetworkBehaviour
{
void Update()
{
if (!isLocalPlayer)
{
// exit from update if this is not the local player
return;
}

// handle player input for movement
}
}
Basic player game state

Make scripts that contain important data into NetworkBehaviours instead of MonoBehaviours
Make important member variables into SyncVars
See State Synchronization.

Networked actions

Make scripts that perform important actions into NetworkBehaviours instead of MonoBehaviours
Update functions that perform important player actions to be commands
See Networked Actions.

Non-player GameObjects

Fix non-player prefabs such as enemies:

Add the NetworkIdentify component
Add the NetworkTransform component
Register spawnable Prefabs with the NetworkManager
Update scripts with game state and actions
Spawners

Potentially change spawner scripts to be NetworkBehaviours
Modify spawners to only run on the server (use isServer property or the OnStartServer() function)
Call NetworkServer.Spawn() for created GameObjects
Spawn positions for players

Add a new GameObject and place it at player’s start location
Add the NetworkStartPosition component to the new GameObject
Lobby

Create Lobby Scene
Add a new GameObject to the Scene and rename it to “NetworkLobbyManager”.
Add the NetworkLobbyManager component to the new GameObject.
Configure the Manager:
Scenes
Prefabs
Spawners
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.