pls help the host can’t move and watch around here is my script:
using UnityEngine;
using gui = UnityEngine.GUILayout;
public class GameMenu : MonoBehaviour
{
public GameObject PlayerPrefab;
string ip = "192.168.1.5";// ip : 127.0.0.1
static string playername = "Guest";
public void CreatePlayer()
{
connected = true;
var pl = (GameObject)Network.Instantiate(PlayerPrefab, transform.position, transform.rotation, 1);
pl.camera.enabled = true;
transform.camera.enabled = false;
}
void OnDisconnectedFromServer()
{
connected = false;
}
void OnPlayerDisconnected(NetworkPlayer pl)
{
Network.DestroyPlayerObjects(pl);
}
void OnConnectedToServer()
{
CreatePlayer();
}
void OnServerInitialized()
{
CreatePlayer();
}
bool connected;
void OnGUI()
{
if (!connected)
{
ip = gui.TextField(ip);
playername = gui.TextField(playername);
if (gui.Button("^2Connect to Match"))
{
Network.Connect(ip, 5300);
}
if (gui.Button("^1Host a Match"))
{
Network.InitializeServer(10, 5300, false);
}
if (gui.Button("^3Single match"))
{
Application.LoadLevel ("Single");
}
}
}
}