Light Manager

Managing dynamic lighting like point lights and spot lights in a game can be an added burden without any out of the box helpers.

Thankfully, the HYTOPIA SDK ships with a Light Manager, allowing you to retrieve Light instances of point lights and spot lights in a world.

Accessing A LightManager

The LightManager is used as a singleton and automatically created for a given world instance.

You can access the light manager for a world like this:

world.lightManager

Using A LightManager

The LightManager exposes a number of ways to get Light instances for a world. Light instances will either be a point light, or spot light. Here's an exampel of how to use it.

// Returns an array of all loaded light instances
// for the world
world.lightManager.getAllLights();

// Returns an array of all loaded light instances
// attached to the provided entity
world.lightManager.getAllEntityAttachedLights(someEntity);

Diving Deeper

The LightManager class is constantly evolving. You can find the latest LightManager API Reference herearrow-up-right.

If there are features that we don't currently support for LightManager that you'd like to see added to the HYTOPIA SDK, you can submit a feature request herearrow-up-right.

Last updated