I’m building a game (using Unity Networking) that should be playable solo or with friends. I will be launching on PC/Mac, but I’d like to make a WebGL build in the meantime for easier playtesting. It builds fine and, using Websockets, I can connect to the host running in the editor. The Network Manager HUD won’t let my WebGL build start the game as a Host though. I am fine with the WebGL build not being able to accept incoming connections, but is it possible to get it running as a Host and just not be able to have friends join?
WebGL can’t run as host. Sorry, but that is a limitation of the platform.
I had similar problem. Starting from Unity 5.3.1 it is possible to set NetworkServer.dontListen. This flag can be used to start host in WebGL build with NetworkManager.StartHost().
Disabling server listening is enough because the only problem with starting server in WebGL build is failure to listen on any port (tested in Unity 5.6 and 2017.2). I was ready to modify Unity Networking to accomplish this but it wasn’t necessary. This solution doesn’t work with Network Manager HUD.