public bool StartServer(string bind_to_address = "127.0.0.1", int port = 7777, int maxPlayers = 32) { OnPreServerInit(); if (server_peer == null) { server_peer = RakNet_Peer.CreateServer(bind_to_address, port, maxPlayers); if (server_peer != null) { Query.info.maxPlayers = (byte)maxPlayers; Query.info.version = Application.version; try { Query.Initialize(port + 1); } catch { Debug.LogError("Query initialized failure! Please port " + (port + 1)); } OnServerInitSuccess(bind_to_address, port); Debug.Log("Server started -> " + bind_to_address + ":" + port + " Max Players: " + maxPlayers + "\nGame/Engine version -> " + Application.version + "/" + Application.unityVersion); return(true); } else { OnServerInitFailed(); return(false); } } else { Debug.LogWarning("[Server] Is already running..."); return(false); } }