Hi all.
I'm try to start a master server after click on my button.
Alternative: Create a new script that will find Master in the scene, and call the master.StartServer() whenever you want (click of a button and so on)
I'm using singleton
Master.Instance.StartServer();
and receiving this error
NullReferenceException: Object reference not set to an instance of an object
StartServerScript.OnStartServerClick () (at Assets/FromScratch/Scripts/StartServerScript.cs:8)
This's occur because _clientsSocket is NULL in public virtual void StartServer() in Master.cs
OK, I've seen that code _clientsSocket = Connections.CreateServerSocket(); not executed
because in Awake method (Master.cs) condition
if (ShouldBeDestroyed())
{
Destroy(gameObject);
return;
}
always TRUE
It's occur in Editor and in executable file. Flag Auto Start In Editor I'm disabled.
After comment
Hi all. I'm try to start a master server after click on my button.
I'm using singleton
Master.Instance.StartServer();
and receiving this error
This's occur because _clientsSocket is NULL in
public virtual void StartServer()
in Master.csOK, I've seen that code
_clientsSocket = Connections.CreateServerSocket();
not executed because in Awake method (Master.cs) conditionalways TRUE
It's occur in Editor and in executable file. Flag
Auto Start In Editor
I'm disabled. After commentIt's work fine.
PS: Sorry for my English. :)