Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed May 07, 2014 at 01:34 AM by thornekey for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by thornekey · May 05, 2014 at 01:41 AM · c#networkingmultiplayermasterserver

Master Server GUI not showing up [Errors finally coming up in console]

im trying to connect to the master server and the GUI to look for a server is not showing up. Im calling a function from within the GUI function so it should work.

   if (GUI.Button(new Rect(Screen.width / 2 - 64, Screen.height / 2 + 144, 132, 32),"World-Wide Connect")) {
     MastServ();
     menu_WWconnect = true;
     play_menu = false;
     }
      
     if (menu_WWconnect) {
     ServerWWConnect ();
     }


     void ServerWWConnect ()
     {
      
      
     playerName = GUI.TextField(new Rect(Screen.width / 2 - 64, Screen.height / 2 - 47, 128, 24), playerName, 18);
      
     HostData[] data = MasterServer.PollHostList();
      
     foreach(HostData element in data) {
     GUILayout.BeginHorizontal();
     string name= element.gameName + " -- " + element.connectedPlayers + " / " + element.playerLimit;
     GUILayout.Label(name);
     GUILayout.Space(5);
     string hostInfo;
     hostInfo = "[";
     foreach(string host in element.ip)
     hostInfo = hostInfo + host + ":" + element.port + " ";
     hostInfo = hostInfo + "]";
     GUILayout.Label(hostInfo);
     GUILayout.Space(5);
     GUILayout.Label(element.comment);
     GUILayout.Space(5);
     GUILayout.FlexibleSpace();
     if (GUILayout.Button("Join")) {
     Network.Connect(element);
     PlayerPrefs.SetString("Player_Name", playerName);
     }
     GUILayout.EndHorizontal();
     }
      
     if (GUI.Button(new Rect(32, Screen.height - 64, 128, 32),"Back")) {
     menu_WWconnect = false;
     play_menu = true;
     }
     }

I think its in the last part

Comment
Add comment · Show 20
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image clunk47 · May 05, 2014 at 04:13 AM 0
Share

All GUI code must be inside of void OnGUI(). $$anonymous$$ost of your gui code here is inside your ServerConnect method.

avatar image thornekey clunk47 · May 05, 2014 at 04:29 AM 0
Share

it works with other stuff, for me. And by that I mean, calling an external function from outside OnGUI..

avatar image clunk47 clunk47 · May 05, 2014 at 04:58 AM 0
Share
 using UnityEngine;
 using System;
 using System.Collections;
 
 public class Example : $$anonymous$$onoBehaviour 
 {
     void Update()
     {
         NotInGUI();
     }
 
     //Will not work.
     void NotInGUI()
     {
         GUILayout.Label("Outside of GUI Function");
     }
 
     //Will work.
     void OnGUI()
     {
         GUILayout.Label("Inside GUI Function");
     }
 }
 

You should be getting an exception if using GUI code outside of GUI function.

notingui.png (3.4 kB)
avatar image thornekey clunk47 · May 05, 2014 at 05:38 AM 0
Share

putting it back inside OnGUI did not do anything.

Show more comments
avatar image clunk47 · May 05, 2014 at 12:54 PM 0
Share

alt text

screenshot_2.png (19.2 kB)
avatar image thornekey · May 05, 2014 at 12:55 PM 0
Share

nono that comes up fine! its not when I create a server.. its when i look for that (connecting)

avatar image clunk47 · May 05, 2014 at 12:56 PM 0
Share

No warnings or exceptions in the console?

avatar image thornekey · May 05, 2014 at 01:00 PM 0
Share

as you can see, creating it works finw. alt text

now, if another player clicks browse servers... alt text

now, in this final picture, the list of servers (the one we just made), should show up in a horiz layout, with the name, and a button saying "Join" but it doesnt. that is the issue. alt text

picture 3.png (435.0 kB)
picture 5.png (414.3 kB)
picture 6.png (422.4 kB)
Show more comments

1 Reply

  • Sort: 
avatar image
2
Best Answer

Answer by thornekey · May 06, 2014 at 01:08 PM

Solved it!

In the end, the issue was simple.

I had this:

             MasterServer.RegisterHost(myGameType,"RobotCountDown", myGameDesc);

myGameType was where the game name should be. I got them around the wrong way!

lol silly

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image clunk47 · May 06, 2014 at 02:03 PM 1
Share
  • for posting your solution! I re-accepted your answer so you could get a bit of karma ;)

avatar image thornekey · May 06, 2014 at 10:41 PM 0
Share

thanks :) It was good to figure it out myself. Only took 2 days ahah

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity networking tutorial? 6 Answers

Client can't spawn GameObject's 0 Answers

[Command] Attribute Returning Warnings and Errors 0 Answers

Unity3d Csharp Networking Error 3 Answers

Distribute terrain in zones 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges