Modern 2D LightRays
Modern 2D LightRays

Runtime API

Control the most useful ray settings from gameplay, cutscenes and environment systems.

Unity 2021.3 → 6.7+URP 2DPixel ArtLight2D

Common controls

using LightRays2D;
using UnityEngine;

public class RayExample : MonoBehaviour
{
    public LightRays2D.LightRays2D ray;

    public void EnterNightMode()
    {
        ray.SetIntensity(0.45f);
        ray.SetColor(new Color(0.55f, 0.72f, 1f));
        ray.SetBlendMode(BlendingMode.screen);
    }
}

Pixel art

ray.SetPixelArt(true, 64);

Emitters

ray.SetEmitter(windowSpriteRenderer);
ray.SetEmitter(windowCollider);
ray.UseManualEmitter();

Dust and particles

ray.SetDustMotes(true);
ray.SetDustMotes(false);

Matching Light2D

ray.SetLight2DEnabled(true);
ray.SetLight2DIntensityMultiplier(1.2f);
ray.SetLight2DColorSync(true, Color.white);
ray.SetLight2DShadows(true, 0.6f);

Preset libraries

ray.ApplyPreset(LightRaysPreset.WarmWindow);
ray.ApplyGradientPreset(LightRaysGradientPreset.Moonlight);
ray.ApplyNoisePreset(LightRaysNoisePreset.Wispy);

Global control

LightRaysGlobalController.SetGlobalIntensity(0.8f);
LightRaysGlobalController.SetGlobalTint(new Color(1f, 0.85f, 0.7f));
LightRaysGlobalController.SetGlobalAnimationSpeed(0.6f);
The runtime API focuses on common gameplay controls. Advanced ray-layer values are intended to be authored in the Inspector.