Skip to content

Turn on a light at night

Use a reactive Light response for lamps that follow the simulated Sun rather than a fixed hour. This also accommodates seasonal sunrise changes and polar conditions.

  1. Start with an initialized context containing Time, Calendar, and Astronomy, with valid profiles.
  2. Create a Point Light outside the sky's directional-light rig. Add SystemBasedLight to the same GameObject.
  3. Assign Context if the lamp is outside that context's hierarchy. Leave Automated enabled.
  4. Add one condition with source Astronomy, metric Daylight, and Invert enabled.
  5. Set Inactive Intensity to zero and Active Intensity to the desired lamp intensity. Choose a short fade in the response's shared settings.
  6. Enter Play Mode. Move simulated time between daylight and night; inspect target/applied influence and the Light intensity.

Expected result: influence approaches one when Astronomy reports no daylight, then returns toward zero in daylight. The fade uses scaled frame time; it is separate from the speed of the simulated clock.

For gradual dusk rather than a boolean daylight boundary, use Solar Elevation with a reversed numeric Ramp. A missing Astronomy system still yields zero; Invert does not turn a missing dependency into nighttime. Check ownership and initialization before adjusting the light.

Related: conditions, responses, astronomy.