Entity Manager
In more complex games, it's common to have many different entities spawned at the same time. This can become cumbersome to track or manage, especially if you need to do things like perform operations on specific entities.
Thankfully, we have the EntityManager that exposes ways to quickly retrieve and iterate all spawned Entities in a world.
Accessing An EntityManager
The EntityManager is used as a singleton and automatically created for a given world instance.
You can access the entity manager for a world like this:
Using An EntityManager
The EntityManager exposes a number of ways to get different types of Entities for a world. Here's some examples of how you can use it.
Diving Deeper
The EntityManager class is constantly evolving. You can find the latest EntityManager API Reference here.
If there are features that we don't currently support for EntityManager that you'd like to see added to the HYTOPIA SDK, you can submit a feature request here.
Last updated