LogoLogo
  • Get Started
  • Getting Started
    • Initial Setup
    • Create Your First Game
    • API Reference
    • Build Your First World Map
    • Multiplayer Testing
    • Use Templates & Examples
    • Styling & Assets
      • Modeling Guidelines
      • Texturing Guidelines
      • Default Assets
  • Build Faster With AI Tools
  • SDK Guides
    • Assets
    • Audio & SFX
      • Audio Manager
    • Blocks & Chunks
      • Block Types
      • Block Type Registry
      • Chunks
      • Chunk Lattice
    • Camera
    • Chat & Commands
    • Debugging
    • Entities
      • Animations
      • Block Entities
      • Colliders & Hitbox
      • Child Entities
      • Entity Controllers
        • Base Entity Controller
        • Pathfinding Entity Controller
        • DefaultPlayer Entity Controller
        • Simple Entity Controller
      • Entity Manager
      • Model Entities
      • Movement & Pathfinding
      • Player Controlled Entities
    • Events
    • Input & Controls
    • Lighting
      • Ambient Light
      • Light Manager
      • Point Lights
      • Spot Lights
      • Sun Light (Directional)
    • Mobile
    • Persisted Data
    • Players
      • Player Manager
      • Persisted Player Data
    • Plugins
    • Physics
      • Colliders
      • Collision Groups
      • Debugging
      • Gravity
      • Raycasts
      • Rigid Bodies
    • User Interface
      • Overlay UI
      • Scene UIs
      • Scene UI Manager
    • Worlds
      • Map Data Format
  • Helpful Resources
    • HYTOPIA Architecture & Platform Overview
    • Useful Third-Party Tools
Powered by GitBook
On this page
  • Accessing A LightManager
  • Using A LightManager
  • Diving Deeper
Export as PDF
  1. SDK Guides
  2. Lighting

Light Manager

PreviousAmbient LightNextPoint Lights

Last updated 4 months ago

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 .

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 .

LightManager API Reference here
submit a feature request here