So i’ve made an simple Network script but my GUI doesn’t show up.
var typeName : String = "UniqueGameName";
var gameName : String = "Dein Servername";
var hostList :HostData[];
//Network
function Start()
{
}
function OnServer()
{
Network.InitializeServer(4, 25000, !Network.HavePublicAddress);
MasterServer.RegisterHost(typeName, gameName);
}
function JoinServer(hostData : HostData)
{
Network.Connect(hostData);
}
function RefreshHostList()
{
MasterServer.RequestHostList(typeName);
}
function OnMasterServerEvent(msEvent : MasterServerEvent)
{
if(msEvent == MasterServerEvent.HostListReceived)
{
hostList = MasterServer.PollHostList();
}
}
//Network
//GUIS
function OnGUI()
{
if(!Network.isClient && !Network.isServer)
{
if(GUI.Button( Rect( 100, 100, 250, 100), "Server starten"));
{
OnServer();
}
if(GUI.Button( Rect( 100, 250, 250, 100), "Hosts aktualisieren"))
{
RefreshHostList();
}
if(hostList != null)
{
for(var i :int = 0; i < hostList.Length; i++)
{
if(GUI.Button(Rect(400,100 + (110 + i), 300, 100), hostList*.gameName))*
-
{*
_ JoinServer(hostList*);_
_ }_
_ }_
_ }_
_ gameName = GUI.TextField(Rect(400, 100, 400, 25), gameName);*_
* }*
}
No Errors.
The GUI just doesn’t appear.
I’ve also edited the script so i can see if im connected as Server or Client.
The Game automatically told me i’m connected as Server even though i could’nt press the button to actually host an server