Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Networking Unity:本地(LAN)匹配错误_Networking_Unity3d_Unity Networking_Unity3d Unet_Unet - Fatal编程技术网

Networking Unity:本地(LAN)匹配错误

Networking Unity:本地(LAN)匹配错误,networking,unity3d,unity-networking,unity3d-unet,unet,Networking,Unity3d,Unity Networking,Unity3d Unet,Unet,我正在尝试创建一个简单的多人游戏。我已经设置了一个配对系统,当设备连接到互联网时,它工作正常,即成功创建了一个在线大厅。但当我试图在本地网络上创建一个没有互联网接入的大厅时,什么也没发生 以下是我用来主持游戏的代码: void Start() { netManager = NetworkManager.singleton; if(netManager.matchMaker == null) { netManager.StartMatchMaker();

我正在尝试创建一个简单的多人游戏。我已经设置了一个配对系统,当设备连接到互联网时,它工作正常,即成功创建了一个在线大厅。但当我试图在本地网络上创建一个没有互联网接入的大厅时,什么也没发生

以下是我用来主持游戏的代码:

void Start()
{
    netManager = NetworkManager.singleton;
    if(netManager.matchMaker == null)
    {
        netManager.StartMatchMaker();
    }

    roomName = "MyGameRoom";
    roomSize = 12;
}

public void CreateRoom()
{
    if (roomName != "" && roomName != null)
    {
        Debug.Log("Creating Room:" + roomName);
        netManager.matchMaker.CreateMatch(roomName, roomSize, true, "", "", "", 0, 0, netManager.OnMatchCreate);
    }
}
现在,如果设备已连接到internet,则游戏将成功托管。但是,如果设备连接到没有互联网服务的wifi,则调用
CreateRoom
方法时不会发生任何事情

CreateRoom()
方法与按钮的
onClick
事件链接

我是unity网络新手,希望有人能指出我做错了什么。
谢谢。

基本的婚介服务基于连接到unity MatchMaker服务器()而此服务器位于internet上,这意味着如果您未连接到internet,则无法连接到它。解决方案是使用,它允许服务器通过网络发送广播消息,以便客户端可以“听到”广播,然后连接到发送方。如果需要示例,请检查此项。

在编辑器中运行应用程序时,请检查控制台,如果有错误,请在问题中添加错误。@itay_421无错误,这是控制台所说的<代码>MatchMakingClient创建:https://mm.unet.unity3d.com/json/reply/CreateMatchRequest UnityEngine.Networking.Match.NetworkMatch:CreateMatch(String,UInt32,Boolean,String,String,String,Int32,Int32,DataResponseDelegate1)`