Can you help me? I have the problem: Unhandled message 70 etc etc…
Like this:
http://forum.unity3d.com/threads/77614-Unity-3.2-amp-Nat-Punchthrough-bug-(using-the-Master-Server)
this is my server script:
var connesso=false;
var giaconnesso=false;
function OnGUI() {
if(!connesso){
if (GUILayout.Button ("Lancia Server")) {
// Use NAT punchthrough if no public IP present
var useNat = !Network.HavePublicAddress();
Network.InitializeServer(32, 25002, useNat);
MasterServer.RegisterHost("Yumyna", "Yuma", "Questa è solo una descrizione");
Debug.Log ("Hai lanciato il Server");
connesso=true;
}
}
else
{
if (GUILayout.Button ("Disconnetti Server")) {
Network.Disconnect();
MasterServer.UnregisterHost();
Debug.Log ("Hai disconnesso il Server");
connesso=false;
}
}
if (giaconnesso){
GUI.Label (Rect (60, 1, 100, 20), "Attenzione! Forse qualcun'altro ha gia lanciato il Server! Prova a ricevere la partita e, se è presente, connettiti ad essa!");
}
}
//////////////////////////////////////////////////////////qui gestisco lo staccamento delle funzioni di connessione client se già ho creato un server
function Update(){
if(connesso==true){
var script : ClientMaster = GameObject.Find("Client").GetComponent("ClientMaster");
script.enabled = false;
}
if(connesso==false){
var script1 : ClientMaster = GameObject.Find("Client").GetComponent("ClientMaster");
script1.enabled = true;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////qui genero l'errore nel caso provi a collegarmi come Server ma un Server è già stato creato
function OnFailedToConnectToMasterServer(info : NetworkConnectionError) {
Debug.Log("Could not connect to master server: "+ info);
giaconnesso=true;
}
function OnFailedToConnect(error : NetworkConnectionError) {
Debug.Log("Could not connect to server: "+ error);
giaconnesso=true;
}
And this is my client Script
var unito=false;
function OnGUI() {
if(!unito){
if (GUI.Button(Rect(0,30,90,20),"Ricevi partita"))
{
MasterServer.ClearHostList();
MasterServer.RequestHostList("Yumyna");
}
}
var data : HostData[] = MasterServer.PollHostList();
// Go through all the hosts in the host list
for (var element in data)
{
GUILayout.BeginHorizontal();
var name = element.gameName + " " + element.connectedPlayers + " / " + element.playerLimit;
if(!unito){
if (GUI.Button(Rect(0,60,125,20),"Unisciti alla partita"))
{
// Connect to HostData struct, internally the correct method is used (GUID when using NAT).
Network.Connect(element);
unito=true;
}
GUILayout.EndHorizontal();
}
else
{
if (GUI.Button(Rect(0,60,115,20),"Esci dalla partita"))
{
Network.Disconnect();
unito=false;
}
}
}
}
function OnConnectedToServer() {
Debug.Log("Ti sei connesso al Server");
// Send local player name to server ...
}
function Update(){
if(unito==true){
var script : LanciaMasterServer = GameObject.Find("Server").GetComponent("LanciaMasterServer");
script.enabled = false;
}
if(unito==false){
var script1 : LanciaMasterServer = GameObject.Find("Server").GetComponent("LanciaMasterServer");
script1.enabled = true;
}
}
Can you help me to resolve the problem modifying my scripts with the “Pseudo Code” in the link ?
...
host.useNat = true;
Network.Connect(host.guid);