Skip to content

Commit

Permalink
add more documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
in0finite committed Apr 3, 2022
1 parent 7d8804e commit e175541
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ Attach `NetworkDiscovery` script to any game object. Assign game server port num
Now, you can use `NetworkDiscoveryHUD` script to test it (by attaching it to the same game object), or use the API directly:

```cs
// when your game server starts, initialize the network discovery
networkDiscovery.EnsureServerIsInitialized();

// register listener - this can also be done from Inspector
networkDiscovery.onReceivedServerResponse.AddListener((NetworkDiscovery.DiscoveryInfo info) =>
{
Expand All @@ -47,6 +50,9 @@ networkDiscovery.SendBroadcast();

// on server side, you can register custom data for responding
networkDiscovery.RegisterResponseData("Game mode", "Deathmatch");

// when your game server is stopped, shutdown the network discovery
networkDiscovery.CloseServerUdpClient();
```

For more details on how to use it, check out `NetworkDiscoveryHUD` script.
Expand Down

0 comments on commit e175541

Please sign in to comment.