- Home /
My server wont start!
I am trying to make a server i have to many guiclips popping dont know why... i am watching the youtube video on how to make a sever + client by the coding shack
heres my scripts
using UnityEngine; using System.Collections; using System.Xml; using System.Xml.Serialization; using System.IO; using System.Text;
public class Core : MonoBehaviour {
public int Server01Port = 25000;
public GameObject Player;
public int DefaultLevel = 1;
public int DefaultHealth = 100;
public int DefaultEnergy = 50;
public Vector3 Startpos= new Vector3(1f,1f,1f);
bool _ShouldSave, _ShouldLoad,_SwitchSave,_SwitchLoad;
string _FileLocation,_FileName;
// AccountStructure RegisterData; string _data;
private bool Server = false; //Main Server (Default on/off)
public ArrayList playerScripts = new ArrayList();
public void Start()
{
_FileLocation = Application.dataPath;
// RegisterData = new AccountStructure();
}
public void OnGUI()
{
GUI.BeginGroup(new Rect(Screen.width /2f - 300,Screen.height /2f - 300,600,600));
if(Server == false)
{
if(GUI.Button(new Rect(200,50,200,50),"Start Server On Port: " + Server01Port))
{
StartServer();
}
}
else{
if(GUI.Button(new Rect(200,50,200,50),"Stop Server. Warning!"))
{
StopServer();
}
}
}
public void StartServer()
{
Network.InitializeServer(32,Server01Port, false);
Server = true;
}
public void StopServer()
{
Network.Disconnect(); // Shut down server (all connections)
Server = false;
}
void OnServerInitiatized()
{
print("Server has started on Port: " + Server01Port + " Successfully");
}
}
Your answer
Follow this Question
Related Questions
i get errors but i have no idea why 0 Answers
how to build & populate an array available to all scripts on all objects? 1 Answer
Assigning Default References to a script itself versus a GameObject using that script? 1 Answer
Accessing an Array in another function 1 Answer
Is there a "library" of scripts? 1 Answer