Player Manager
Depending on the type of game you're building, you may need to get a list of all the currently connected players, or filter through players by username or something else. This can be cumbersome to manually track yourself.
Thankfully, we have the PlayerManager that exposes ways to quickly retrieve and iterate all Players connected to your game server, get a player by username if they're connected, and more.
Accessing The PlayerManager
The PlayerManager is used as a singleton and automatically created for the singleton GameServer instance.
You can access the player manager for your game like this:
Using The PlayerManager
The PlayerManager exposes a number of ways to get players connected to your game server. Here's some exampels of how to use it.
Diving Deeper
The PlayerManager class is constantly evolving. You can find the latest PlayerManager API Reference here.
If there are features that we don't currently support for PlayerManager that you'd like to see added to the HYTOPIA SDK, you can submit a feature request here.
Last updated