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.
Ver Utilizando el NetworkManager.
playerPrefab
in the NetworkManager’s Spawn Info section to the player PrefabSee Player Objects for more information.
isLocalPlayer
isLocalPlayer
Por ejemplo, este script solamente procesa input para el jugador local:
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
}
}
Ver acciones en Red.
Arregle prefabs no-jugador como lo son enemigos:
OnStartServer()
function)NetworkServer.Spawn()
for created GameObjects