I create a match using the new Unity Networking framework , but when my colleagues try fetching it from their own computers (clicking “List Current Matches”) they find nothing.
and vice versa: when I look for matches they created I keep getting
The code is as follows(XXX is the AppID I got under my CloudID, which I already set up in the project’s settings under “player”):
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Networking.Types;
using UnityEngine.Networking.Match;
using System.Collections;
public class ServerOps : NetworkManager {
bool setNM = false;
public GameObject playerCamera;
private NetworkMatch networkMatch;
void Start()
{
InitMatchMaker ();
}
void InitMatchMaker()
{
StartMatchMaker ();
matchMaker.SetProgramAppID ((AppID)XXX);
}
public void CreateMatch()
{
matchMaker.CreateMatch (matchName,
8,
true,
"",
OnMatchCreate);
}
public void JoinMatch(int index)
{
matchMaker.JoinMatch (matches[index].networkId, "", OnMatchJoined);
}
public override void OnServerAddPlayer(NetworkConnection conn, short playerControllerId)
{
GameObject player = (GameObject)GameObject.Instantiate (playerPrefab, GameObject.Find ("Player Spawn").transform.position, Quaternion.identity);
GameObject.Instantiate(playerCamera).GetComponent<FollowTarget>().target = player.transform.GetChild(0);
NetworkServer.AddPlayerForConnection(conn, player, playerControllerId);
}
void OnGUI()
{
GUILayout.Label ("Match Name:");
matchName = GUILayout.TextField (matchName);
if (GUILayout.Button ("Host"))
{
CreateMatch ();
}
if(GUILayout.Button ("List Current Matches"))
{
matchMaker.ListMatches(0,
20,
"",
OnMatchList);
}
if(matches != null)
{
for(int i=0; i<matches.Count; i++)
{
if(GUILayout.Button ("Join " + matches[i].name))
{
JoinMatch(i);
}
}
}
}
}
I think it might be in the Manager’s settings though.
thank you in advance.