Skip to main content
All light components inherit from the abstract Light base class, which provides color, shadow, and fog properties common to every light type. Add a light component to a GameObject and position it in the scene to illuminate your world.

Light base properties

Every light type exposes the following shared properties.
LightColor
Color
default:"#E9FAFF"
The main color of the light. Drives the tint and intensity of the light’s output.
Shadows
bool
default:"true"
Whether this light casts shadows. Disabling shadows improves performance.
ShadowHardness
float
default:"0.0"
Controls shadow edge softness. 0 gives the softest shadows; 1 gives hard-edged shadows. Range 0–1.
ShadowBias
float
default:"0.0005"
Depth bias applied to shadow maps to reduce self-shadowing artefacts. Range 0–1. This is an advanced property.
FogMode
FogInfluence
default:"Enabled"
Controls how this light interacts with volumetric fog. Options: Disabled, Enabled, WithoutShadows.
FogStrength
float
default:"1.0"
How strongly this light contributes to fog scattering. Range 0–1.

Light types

Emits light in all directions from a single point in space, like a lightbulb.
Radius
float
default:"400"
Maximum distance in world units that the light reaches. Objects beyond this distance receive no illumination.
Attenuation
float
default:"1.0"
Controls the quadratic falloff of the light with distance. Higher values cause the light to drop off more sharply. Range 0–10.
var point = Components.Get<PointLight>();
point.LightColor = Color.Orange;
point.Radius = 600f;
point.Attenuation = 0.5f;

Changing color and brightness at runtime

The following example shows how to pulse a point light’s color and simulate a brightness change by scaling LightColor.
using Sandbox;

public sealed class PulsingLight : Component
{
    PointLight _light;

    protected override void OnStart()
    {
        _light = Components.Get<PointLight>();
    }

    protected override void OnUpdate()
    {
        if ( _light is null ) return;

        // Oscillate between dim and bright using a sine wave
        float brightness = 0.5f + 0.5f * MathF.Sin( Time.Now * 2f );

        // Multiply the base color by the brightness factor
        _light.LightColor = Color.Orange * brightness;

        // Also shrink the radius when dim for a more dramatic effect
        _light.Radius = 200f + 200f * brightness;
    }
}
LightColor is a standard Color value. Multiply it by a scalar to vary brightness without introducing a separate intensity property.

Build docs developers (and LLMs) love