Unity:网络多人游戏

Unity: Network Multiplayer

我正在尝试做到这一点,当我点击一个服务器时,它会被选中,然后我可以在点击它后 运行 编码。

感谢您提供的一切帮助。

function OnGUI() {
    if (!Network.isClient && !Network.isServer) {
        if (joining) {
            if (hostData) {
                scrollPosition = GUI.BeginScrollView(Rect(Screen.width / 4, Screen.height /
                    6, Screen.width / 1.5, Screen.height / 2), scrollPosition, Rect(0, 0,
                    300, 1000 /* hostData.length * 30 */ ));
                GUI.Label(Rect(30, 0, 100, 20), "Game Name");
                GUI.Label(Rect(350, 0, 100, 20), "Server Info");
                GUI.Label(Rect(590, 0, 100, 20), "Player Count");
                GUI.Label(Rect(700, 0, 100, 20), "Password");
                for (var i: int = 0; i < hostData.length; i++) {

                    GUI.Label(Rect(0, 30 + i * 30, 200, 22), hostData[i].gameName);
                    GUI.Label(Rect(160, 30 + i * 30, 500, 22), hostData[i].comment);
                    GUI.Label(Rect(610, 30 + i * 30, 100, 20), hostData[i].connectedPlayers +
                        " / " + hostData[i].playerLimit);
                    if (hostData[i].passwordProtected) {
                        clientPass = GUI.PasswordField(Rect(680, 30 + i * 30, 100, 25),
                            clientPass, "*" [0], 12);
                    }
                    if (GUI.Button(Rect(800, 30 + i * 30, 100, 25), "Join")) {
                        Network.Connect(hostData[i], clientPass);
                    }
                }
                GUI.EndScrollView();
            }

我发现了问题。当我更改屏幕分辨率时很明显。只需将我的屏幕分辨率更改为 16x9 或 16x10,按钮就会出现。