# Lightmapping

> Allows to control the lightmapping job.

## Definition

* **Type:** Class
* **Namespace:** [UnityEditor](/engine/6000.7/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
public static class Lightmapping
```

## Remarks

Before starting the job the bake settings can be set via [LightingSettings](/engine/6000.7/script-reference/unityengine/lightingsettings.md).

Additional Resources: [LightingSettings](/engine/6000.7/script-reference/unityengine/lightingsettings.md).

## Static Properties

| Property                                                                                                         | Description                                                                                                                                                                                                                                                             |
| ---------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [bakedGI](/engine/6000.7/script-reference/unityeditor/lightmapping/bakedgi.md)                                   | This property is now obsolete. Use [LightingSettings.bakedGI](/engine/6000.7/script-reference/unityengine/lightingsettings/bakedgi.md).                                                                                                                                 |
| [bakeOnSceneLoad](/engine/6000.7/script-reference/unityeditor/lightmapping/bakeonsceneload.md)                   | Determines whether lighting data should be generated when loading a scene, for scenes that have not already been baked.                                                                                                                                                 |
| [buildProgress](/engine/6000.7/script-reference/unityeditor/lightmapping/buildprogress.md)                       | Returns the current lightmapping build progress or 0 if [Lightmapping.isRunning](/engine/6000.7/script-reference/unityeditor/lightmapping/isrunning.md) is false.                                                                                                       |
| [isRunning](/engine/6000.7/script-reference/unityeditor/lightmapping/isrunning.md)                               | Returns true when the bake job is running, false otherwise (Read Only).                                                                                                                                                                                                 |
| [lightingDataAsset](/engine/6000.7/script-reference/unityeditor/lightmapping/lightingdataasset.md)               | The lighting data asset used by the active Scene.                                                                                                                                                                                                                       |
| [lightingSettings](/engine/6000.7/script-reference/unityeditor/lightmapping/lightingsettings.md)                 | The [LightingSettings](/engine/6000.7/script-reference/unityengine/lightingsettings.md) that will be used for the current Scene. Will throw an exception if it is null.                                                                                                 |
| [lightingSettingsDefaults](/engine/6000.7/script-reference/unityeditor/lightmapping/lightingsettingsdefaults.md) | Default [LightingSettings](/engine/6000.7/script-reference/unityengine/lightingsettings.md) that Unity uses for Scenes where [Lightmapping.lightingSettings](/engine/6000.7/script-reference/unityeditor/lightmapping/lightingsettings.md) is not assigned. (Read only) |

## Static Methods

| Method                                                                                                                   | Description                                                                                                                                                                                                                            |
| ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AddBakeDelegate](/engine/6000.7/script-reference/unityeditor/lightmapping/addbakedelegate.md)                           | Set a delegate that bakes additional data. This delegate must set its done parameter to true once baking is finished to unlock the baking pipeline.                                                                                    |
| [Bake](/engine/6000.7/script-reference/unityeditor/lightmapping/bake.md)                                                 | Starts a synchronous bake job.                                                                                                                                                                                                         |
| [BakeAsync](/engine/6000.7/script-reference/unityeditor/lightmapping/bakeasync.md)                                       | Starts an asynchronous bake job.                                                                                                                                                                                                       |
| [BakeMultipleScenes](/engine/6000.7/script-reference/unityeditor/lightmapping/bakemultiplescenes.md)                     | Bakes an array of Scenes.                                                                                                                                                                                                              |
| [BakeReflectionProbe](/engine/6000.7/script-reference/unityeditor/lightmapping/bakereflectionprobe.md)                   | Starts a synchronous bake job for the probe.                                                                                                                                                                                           |
| [Cancel](/engine/6000.7/script-reference/unityeditor/lightmapping/cancel.md)                                             | Cancels the currently running asynchronous bake job.                                                                                                                                                                                   |
| [Clear](/engine/6000.7/script-reference/unityeditor/lightmapping/clear.md)                                               | Deletes all runtime data for the currently loaded Scenes.                                                                                                                                                                              |
| [ClearDiskCache](/engine/6000.7/script-reference/unityeditor/lightmapping/cleardiskcache.md)                             | Clears the cache used by lightmaps, reflection probes and default reflection.                                                                                                                                                          |
| [ClearLightingDataAsset](/engine/6000.7/script-reference/unityeditor/lightmapping/clearlightingdataasset.md)             | For the currently loaded Scenes, this method deletes the Lighting Data Asset and any linked lightmaps and Reflection Probe assets.                                                                                                     |
| [GetLightingDataAssetForScene](/engine/6000.7/script-reference/unityeditor/lightmapping/getlightingdataassetforscene.md) | Gets the LightingDataAsset associated with a specific scene. This method will return null if the scene has no LightingDataAsset, or the scene is invalid.                                                                              |
| [GetLightingSettingsForScene](/engine/6000.7/script-reference/unityeditor/lightmapping/getlightingsettingsforscene.md)   | Gets the [LightingSettings](/engine/6000.7/script-reference/unityengine/lightingsettings.md) object of a [Scene](/engine/6000.7/script-reference/unityengine/scenemanagement/scene.md) object.                                         |
| [GetTerrainGIChunks](/engine/6000.7/script-reference/unityeditor/lightmapping/getterraingichunks.md)                     | Get how many chunks the terrain is divided into for GI baking.                                                                                                                                                                         |
| [HasDynamicGILightmapTextures](/engine/6000.7/script-reference/unityeditor/lightmapping/hasdynamicgilightmaptextures.md) | Determines whether any of the currently loaded scenes have Enlighten Dynamic GI lightmaps.                                                                                                                                             |
| [RemoveBakeDelegate](/engine/6000.7/script-reference/unityeditor/lightmapping/removebakedelegate.md)                     | Remove a delegate that bakes additional data.                                                                                                                                                                                          |
| [SetLightingDataAssetForScene](/engine/6000.7/script-reference/unityeditor/lightmapping/setlightingdataassetforscene.md) | Sets the LightingDataAsset associated with a specific scene.                                                                                                                                                                           |
| [SetLightingSettingsForScene](/engine/6000.7/script-reference/unityeditor/lightmapping/setlightingsettingsforscene.md)   | Applies the settings specified in the [LightingSettings](/engine/6000.7/script-reference/unityengine/lightingsettings.md) object to the [Scene](/engine/6000.7/script-reference/unityengine/scenemanagement/scene.md) object.          |
| [SetLightingSettingsForScenes](/engine/6000.7/script-reference/unityeditor/lightmapping/setlightingsettingsforscenes.md) | Applies the settings specified in the [LightingSettings](/engine/6000.7/script-reference/unityengine/lightingsettings.md) object to an array of [Scene](/engine/6000.7/script-reference/unityengine/scenemanagement/scene.md) objects. |
| [Tetrahedralize](/engine/6000.7/script-reference/unityeditor/lightmapping/tetrahedralize.md)                             | Calculates tetrahderons from positions using Delaunay Tetrahedralization.                                                                                                                                                              |
| [TryGetLightingSettings](/engine/6000.7/script-reference/unityeditor/lightmapping/trygetlightingsettings.md)             | Fetches the Lighting Settings for the current Scene. Will return false if it is null.                                                                                                                                                  |

## Static Events

| Member                                                                                                           | Description                                                                                                                                                                                                                                                                                                                                                                       |
| ---------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [bakeCancelled](/engine/6000.7/script-reference/unityeditor/lightmapping/bakecancelled.md)                       | Event which is called when bake job is cancelled.                                                                                                                                                                                                                                                                                                                                 |
| [bakeCompleted](/engine/6000.7/script-reference/unityeditor/lightmapping/bakecompleted.md)                       | Event which is called when bake job is completed. Only called when [LightingSettings.autoGenerate](/engine/6000.7/script-reference/unityengine/lightingsettings/autogenerate.md) is set to false.                                                                                                                                                                                 |
| [bakeStarted](/engine/6000.7/script-reference/unityeditor/lightmapping/bakestarted.md)                           | Event which is called when a bake is started. Only called when [LightingSettings.autoGenerate](/engine/6000.7/script-reference/unityengine/lightingsettings/autogenerate.md) is set to false.                                                                                                                                                                                     |
| [inputExtraction](/engine/6000.7/script-reference/unityeditor/lightmapping/inputextraction.md)                   | Event which is called when the bake job calls ExtractFromScene. This happens when a bake is started from the Editor or a bake is started with the lightmapping API. Additional Resources: [Lightmapping.Bake](/engine/6000.7/script-reference/unityeditor/lightmapping/bake.md), [Lightmapping.BakeAsync](/engine/6000.7/script-reference/unityeditor/lightmapping/bakeasync.md). |
| [lightingDataAssetCleared](/engine/6000.7/script-reference/unityeditor/lightmapping/lightingdataassetcleared.md) | Event which is called when a LightingData asset is removed from the project.                                                                                                                                                                                                                                                                                                      |
| [lightingDataCleared](/engine/6000.7/script-reference/unityeditor/lightmapping/lightingdatacleared.md)           | Event which is called when baked Global Illumination data is cleared from the scene and from renderers.                                                                                                                                                                                                                                                                           |
| [lightingDataUpdated](/engine/6000.7/script-reference/unityeditor/lightmapping/lightingdataupdated.md)           | Event which is called when any lighting data is updated as part of the GI backing process.                                                                                                                                                                                                                                                                                        |

## Enums

| Enum                                                                                                                | Description                                              |
| ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| [Lightmapping.BakeOnSceneLoadMode](/engine/6000.7/script-reference/unityeditor/lightmapping/bakeonsceneloadmode.md) | Enum describing whether a scene should be baked on load. |
| [Lightmapping.GIWorkflowMode](/engine/6000.7/script-reference/unityeditor/lightmapping/giworkflowmode.md)           | Workflow mode for lightmap baking. Default is Iterative. |

## Delegates

| Delegate                                                                                                                    | Description                                                                                                                                                                                      |
| --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Lightmapping.AdditionalBakeDelegate](/engine/6000.7/script-reference/unityeditor/lightmapping/additionalbakedelegate.md)   | Delegate called at the last stage of the baking pipeline.                                                                                                                                        |
| [Lightmapping.BakeDelegate](/engine/6000.7/script-reference/unityeditor/lightmapping/bakedelegate.md)                       | Delegate called at the last stage of the baking pipeline.                                                                                                                                        |
| [Lightmapping.InputExtractionFunction](/engine/6000.7/script-reference/unityeditor/lightmapping/inputextractionfunction.md) | Delegate used by [InputExtraction](/engine/6000.7/script-reference/unityeditor/lightmapping/inputextraction.md) callback. This can be used to modify the BakeInput in order to customize baking. |
| [Lightmapping.OnCompletedFunction](/engine/6000.7/script-reference/unityeditor/lightmapping/oncompletedfunction.md)         | Delegate used by [Lightmapping.completed](/engine/6000.7/script-reference/unityeditor/lightmapping/completed.md) callback.                                                                       |
| [Lightmapping.OnStartedFunction](/engine/6000.7/script-reference/unityeditor/lightmapping/onstartedfunction.md)             | Delegate used by [Lightmapping.started](/engine/6000.7/script-reference/unityeditor/lightmapping/started.md) callback.                                                                           |
