Search Unity

Networked GUI Loop

Discussion in 'Immediate Mode GUI (IMGUI)' started by nickavv, Dec 5, 2007.

  1. nickavv

    nickavv

    Joined:
    Aug 2, 2006
    Posts:
    1,801
    Code (csharp):
    1.     if (gameJoiner == true) {
    2.         var data : HostData[] = MasterServer.PollHostList();
    3.         for (var element in data) {
    4.             GUILayout.BeginHorizontal();   
    5.             var name = element.gameName + ": " + element.comment + " (" + element.connectedPlayers + " / " + element.playerLimit + ")";
    6.             GUILayout.Label(name); 
    7.             GUILayout.Space(5);
    8.             GUILayout.FlexibleSpace();
    9.             if (GUILayout.Button("Connect")) {
    10.                 Network.useNat = element.useNat;
    11.                 if (Network.useNat) {
    12.                     print("Using Nat punchthrough to connect to host");
    13.                 } else {
    14.                     print("Connecting directly to host");
    15.                     Network.Connect(element.ip, element.port);
    16.                 }
    17.                 GUILayout.EndHorizontal();
    18.             }
    19.  
    20.         }
    21.         MasterServer.RequestHostList("RandomBoxWithCubesGame");
    22.  
    23.     }
    I was under the impression that this was working, until I got my hands on multiple computers and attempted to create 2 games at once. The most recently created game showed up fine, but the one before it got squished into a few pixels in the upper-left corner. Obviously squishing all but one game isn't ideal for an online game, so what's wrong?

    Thanks!
     
  2. NicholasFrancis

    NicholasFrancis

    Joined:
    Apr 8, 2005
    Posts:
    1,587
    Can you reproduce the bug without networking playing in? Then submit it as a bug and I'll do my very very best to get rid of it...

    Thanks
     
  3. nickavv

    nickavv

    Joined:
    Aug 2, 2006
    Posts:
    1,801
    Hmm, any way I tried it without the networking worked. So it must be something about the (for element in data) part.