WebGL setup guide
WebGL allows your Unity game to be run on web browsers.
The Hathora Cloud Unity Plugin supports Unity WebGL with WebSocket Secure (WSS) connections. Below you'll find steps to setup WebGL for our FishNet demo.
Steps to enable:
Switch Build Settings to WebGL
- Switch to the "WebGL" platform
- If you are wanting to test with our FishNet demo, make sure that is the first scene
Server deployment (FishNet Demo)
1. Open the FishNet demo scene that comes with our Unity Plugin
2. Inspect the scene's
NetworkManager and locate the
└── Network Manager
3. Set your TransportManager.Transport to use the Bayou transport
4. Configure the Bayou transport to
Use WSS and enter the correct connection info for
- Make sure that
Portis set to "7777" and
Client Addressis set to "localhost", the port needs to match the port in the next step (deployment config).
5. Deploy your server on Hathora Cloud
Important: make sure that you set TLS as the transport type.
Client setup (FishNet Demo)
Build and Run to run the client in the browser
- This may take a few minutes to compile and run (longer the first time you run it)
2. Create a room (via plugin or Hathora Console)
3. Connect to the room using the connection info
- You can type the connection info to connect
- Alternatively, you can also manually set Bayou transport's
Client Addressfields with the created room's connection info. NOTE: this needs to be set before you "Build and Run" your client (step 1).