I have an empty object that has network manager script attached to it, when I run the game in editor I get the error:
NetworkManager detected a script reload in the editor. This has caused the network to be shut down.
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()
after a closer look I found that there’s a 2nd network manager object spawning in the scene.
I was running 5.2f1 and had that problem, updated to 5.3f1 and still have it, I tried the NetworkTransport.Shutdown() then NetworkTransport.Init() and it didn’t work. However when I tried to build and run the build executable it worked without problems.
The scene have 2 input boxes and a button (username, password, login), here’s the code used:
public partial class ClientNetworkManager : Manager {
//(Manager : NetworkManager) is a shared class between the server and client managers, used to initialize variables like connections/prefabs/ip:port/...
string username,password;
static ClientNetworkManager(){
//Used to parse server IP from config file.
}
void Awake(){
base.Initialize ();
}
public void Connect(){
username = GameObject.Find("UsernameInput").GetComponent<InputField>().text;
password = GameObject.Find ("PasswordInput").GetComponent<InputField> ().text;
if (client == null)
client = new NetworkClient ();
if (client.isConnected)
client.Disconnect ();
client.Configure (base.networkConfig, base.maxConnections);
client.Connect (networkAddress, networkPort);
}
}
Any idea what is causing the spawn of 2nd network manager?? and how to fix it??