Lighting in Unity: A Practical Guide for Game Developers

Root Motion vs In-Place Animations
Root Motion vs In-Place Animations
February 23, 2026
Height Maps in Unity
Height Maps in Unity: Turning Flat Surfaces into Real Worlds
February 24, 2026
Root Motion vs In-Place Animations
Root Motion vs In-Place Animations
February 23, 2026
Height Maps in Unity
Height Maps in Unity: Turning Flat Surfaces into Real Worlds
February 24, 2026

Lighting in Unity: A Practical Guide for Game Developers

Lighting can make or break your game. You can have detailed models and sharp textures, but without good lighting, everything feels flat. On the other hand, even simple scenes can look amazing when lit well.

Unity gives you a flexible lighting system that works for both 2D and 3D projects. In this guide, we’ll walk through the fundamentals of lighting in Unity, the different light types, real-time vs baked lighting, lightmapping, global illumination, and practical tips to make your scenes look better without killing performance.

Why Lighting Matters

Lighting does more than just help players see. It sets the mood. It guides attention. It adds depth and realism. A horror scene with soft shadows and limited light feels tense. A bright outdoor scene with warm sunlight feels open and safe.

Before adjusting any settings, ask yourself: what should the player feel in this scene? Your lighting decisions should support that goal.

Types of Lights in Unity

Unity provides four main light types for 3D projects:

  • Directional Light
  • Point Light
  • Spotlight
  • Area Light

Directional Light

Directional lights simulate distant light sources like the sun. They affect the entire scene equally and don’t weaken over distance. Most outdoor scenes use a directional light as the main light source.

You usually only need one directional light. Rotate it to control the angle of sunlight.

Point Light

A point light emits light in all directions from a single point, like a light bulb. It has a range value that controls how far the light reaches.

Use point lights for lamps, torches, glowing objects, or explosions.

Spotlight

A spotlight emits light in a cone shape. It’s perfect for flashlights, car headlights, or stage lighting. You can adjust both the range and the spot angle.

Area Light

Area lights emit light from a rectangular surface. They create soft lighting but only work with baked lighting, not real-time lighting.

Real-Time vs Baked Lighting

One of the most important decisions in Unity lighting is choosing between real-time and baked lighting.

Real-Time Lighting

Real-time lighting updates every frame. If an object moves, the lighting updates immediately. This is necessary for dynamic scenes where lights or objects change frequently.

The downside is performance. Real-time lighting is expensive, especially with shadows.

Baked Lighting

Baked lighting is precomputed and stored in lightmaps. Unity calculates the lighting ahead of time, and during gameplay, it simply reads the result from a texture.

This is much more efficient but only works for static objects.

To bake lighting:

  1. Mark objects as Static in the Inspector.
  2. Open Window → Rendering → Lighting.
  3. Enable Baked Global Illumination.
  4. Click Generate Lighting.

Baked lighting is ideal for indoor environments, architectural scenes, and mobile games.

Mixed Lighting

Mixed lighting combines real-time and baked lighting. For example, static objects receive baked lighting, while dynamic objects use real-time lighting.

This gives you a good balance between quality and performance.

Global Illumination (GI)

Global Illumination simulates how light bounces off surfaces. Without GI, light only hits objects directly. With GI enabled, light reflects and softly illuminates nearby surfaces.

This adds realism. For example, sunlight hitting a red wall will cast a slight red tint onto nearby objects.

Unity supports both real-time GI (limited and performance-heavy) and baked GI (recommended for most projects).

Lightmaps Explained

A lightmap is a texture that stores baked lighting information. Instead of calculating lighting every frame, Unity uses this precomputed texture.

To get good lightmaps:

  • Ensure your models have proper UV maps for lightmapping.
  • Avoid overlapping UVs.
  • Adjust lightmap resolution in the Lighting settings.

If shadows look blurry, increase lightmap resolution. If performance drops or memory usage is high, reduce it.

Shadows in Unity

Shadows add depth but can hurt performance.

Each light has shadow settings:

  • Hard Shadows – sharp edges, cheaper performance.
  • Soft Shadows – smoother edges, more realistic but heavier.

You can control shadow distance in Project Settings → Quality. Reducing shadow distance improves performance, especially in large outdoor scenes.

Controlling Lighting with C#

You can control lights at runtime using scripts. For example, toggling a flashlight on and off:

using UnityEngine;

public class Flashlight : MonoBehaviour
{
    public Light flashlight;
    private bool isOn = false;

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F))
        {
            isOn = !isOn;
            flashlight.enabled = isOn;
        }
    }
}

This script enables or disables a Light component when the player presses F.

You can also adjust intensity dynamically:

using UnityEngine;

public class FlickerLight : MonoBehaviour
{
    public Light pointLight;
    public float minIntensity = 0.5f;
    public float maxIntensity = 1.5f;

    void Update()
    {
        pointLight.intensity = Random.Range(minIntensity, maxIntensity);
    }
}

This creates a flickering effect for torches or candles.

Environment Lighting and Skyboxes

Lighting is not just about light components. Environment lighting plays a huge role.

Go to Window → Rendering → Lighting → Environment. Here you can:

  • Assign a skybox material.
  • Adjust ambient light color.
  • Control reflection intensity.

A skybox affects the overall lighting and reflections in your scene. Outdoor scenes especially benefit from a good skybox setup.

Light Probes

Light probes help dynamic objects receive baked lighting information. Without light probes, moving objects in baked scenes can look out of place.

To use them:

  1. Create a Light Probe Group.
  2. Place probe points around your scene.
  3. Bake lighting again.

Now moving characters will blend better with baked environments.

Reflection Probes

Reflection probes capture the environment and apply reflections to shiny objects.

Place them in rooms or important areas. For indoor scenes, use multiple probes for accurate reflections.

Performance Tips

Lighting is one of the biggest performance factors in Unity. Keep these tips in mind:

  • Limit the number of real-time lights affecting the same object.
  • Use baked lighting whenever possible.
  • Reduce shadow distance.
  • Avoid unnecessary soft shadows.
  • Use light layers to control which objects are affected.

On mobile devices, even a few real-time shadowed lights can significantly reduce frame rate.

URP and HDRP Considerations

If you’re using the Universal Render Pipeline (URP) or High Definition Render Pipeline (HDRP), lighting behaves slightly differently.

URP is optimized for performance and works well for mobile and mid-range hardware. HDRP focuses on high-end visuals with advanced lighting features like volumetrics and ray tracing.

Choose your render pipeline based on your target platform.

Practical Lighting Workflow

Here’s a simple workflow you can follow:

  1. Add a directional light for your main light source.
  2. Set up your skybox and ambient lighting.
  3. Place point and spot lights where needed.
  4. Mark static objects.
  5. Bake lighting.
  6. Add light probes for dynamic objects.
  7. Fine-tune shadows and intensities.

Always test lighting in Play mode. What looks good in Scene view may feel different during gameplay.

Final Thoughts

Lighting in Unity is both technical and artistic. You need to understand the tools, but you also need to think like a cinematographer. Where should the player look? What mood are you trying to create?

Start simple. Use one main light. Add small lights with intention. Bake when possible. Optimize early if you’re targeting mobile.

With practice, lighting becomes one of the most powerful tools in your game development workflow. Master it, and even simple scenes will come alive.

Leave a Reply

Your email address will not be published. Required fields are marked *


Skip to toolbar