This repository hosts a Unity project (version 2021.3.28f1) featuring a server browser built using the Hathora Cloud. The project is an example demonstrating how to list lobbies/rooms in a server browser, with support for the URP pipeline. It's designed primarily for FishNet unity, but most of the code can be adapted for Mirror.
- Clone or download this repository.
- Open the project in Unity 2021.3.28f1 or later.
If you prefer to use the package rather than downloading the full project, follow these steps:
- Import
hathora_cloud_Hathora_Cloud_Unity_plugin_latest.unitypackage
into your project. - Import the
Hathora-Unity-Lobby-Example
package.
The project provides an example of how to integrate a lobby listing system with minimal changes to Hathora's original code. Key prefabs and scripts have been modified to support this feature.
- hathoralobbyrow: Houses the lobby prefab controller script.
- customlobbycanvas: Child of the HathoraManager prefab which holds the lobby prefabs.
Modified scripts include:
- HathoraClientMgrDemoUI: Handles the UI for the client manager demo, including new additions for the custom lobby.
- HathoraFishnetClientMgrDemoUi: Contains the FishNet-specific client manager demo UI.
The LobbyPrefabController
class is responsible for handling individual lobby entries.
The CustomLobbyCanvas prefab is responsible for holding the lobby prefabs, and is a child of the HathoraManager prefab.
The HathoraClientMgrDemoUI
script includes:
OnJoinRoomAsClientBtnClick
: Customized to handle the logic of joining rooms.OnViewLobbies
: Modified to create prefabs and necessary logic to list and create lobbies in the CustomLobbyCanvas.
Feel free to report issues or submit pull requests.