Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Lightmapping

Allows to control the lightmapping job.
Read time 3 minutesLast updated 2 days ago

Definition

  • Type: Class
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule
public static class Lightmapping

Remarks

Before starting the job the bake settings can be set via LightingSettings.
Additional Resources: LightingSettings.

Static Properties

Property

Description

bakedGIThis property is now obsolete. Use LightingSettings.bakedGI.
bakeOnSceneLoadDetermines whether lighting data should be generated when loading a scene, for scenes that have not already been baked.
buildProgressReturns the current lightmapping build progress or 0 if Lightmapping.isRunning is false.
isRunningReturns true when the bake job is running, false otherwise (Read Only).
lightingDataAssetThe lighting data asset used by the active Scene.
lightingSettingsThe LightingSettings that will be used for the current Scene. Will throw an exception if it is null.
lightingSettingsDefaultsDefault LightingSettings that Unity uses for Scenes where Lightmapping.lightingSettings is not assigned. (Read only)

Static Methods

Method

Description

AddBakeDelegateSet a delegate that bakes additional data. This delegate must set its done parameter to true once baking is finished to unlock the baking pipeline.
BakeStarts a synchronous bake job.
BakeAsyncStarts an asynchronous bake job.
BakeMultipleScenesBakes an array of Scenes.
BakeReflectionProbeStarts a synchronous bake job for the probe.
CancelCancels the currently running asynchronous bake job.
ClearDeletes all runtime data for the currently loaded Scenes.
ClearDiskCacheClears the cache used by lightmaps, reflection probes and default reflection.
ClearLightingDataAssetFor the currently loaded Scenes, this method deletes the Lighting Data Asset and any linked lightmaps and Reflection Probe assets.
GetLightingDataAssetForSceneGets the LightingDataAsset associated with a specific scene. This method will return null if the scene has no LightingDataAsset, or the scene is invalid.
GetLightingSettingsForSceneGets the LightingSettings object of a Scene object.
GetTerrainGIChunksGet how many chunks the terrain is divided into for GI baking.
HasDynamicGILightmapTexturesDetermines whether any of the currently loaded scenes have Enlighten Dynamic GI lightmaps.
RemoveBakeDelegateRemove a delegate that bakes additional data.
SetLightingDataAssetForSceneSets the LightingDataAsset associated with a specific scene.
SetLightingSettingsForSceneApplies the settings specified in the LightingSettings object to the Scene object.
SetLightingSettingsForScenesApplies the settings specified in the LightingSettings object to an array of Scene objects.
TetrahedralizeCalculates tetrahderons from positions using Delaunay Tetrahedralization.
TryGetLightingSettingsFetches the Lighting Settings for the current Scene. Will return false if it is null.

Static Events

Member

Description

bakeCancelledEvent which is called when bake job is cancelled.
bakeCompletedEvent which is called when bake job is completed. Only called when LightingSettings.autoGenerate is set to false.
bakeStartedEvent which is called when a bake is started. Only called when LightingSettings.autoGenerate is set to false.
inputExtractionEvent 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, Lightmapping.BakeAsync.
lightingDataAssetClearedEvent which is called when a LightingData asset is removed from the project.
lightingDataClearedEvent which is called when baked Global Illumination data is cleared from the scene and from renderers.
lightingDataUpdatedEvent which is called when any lighting data is updated as part of the GI backing process.

Enums

Enum

Description

Lightmapping.BakeOnSceneLoadModeEnum describing whether a scene should be baked on load.
Lightmapping.GIWorkflowModeWorkflow mode for lightmap baking. Default is Iterative.

Delegates

Delegate

Description

Lightmapping.AdditionalBakeDelegateDelegate called at the last stage of the baking pipeline.
Lightmapping.BakeDelegateDelegate called at the last stage of the baking pipeline.
Lightmapping.InputExtractionFunctionDelegate used by InputExtraction callback. This can be used to modify the BakeInput in order to customize baking.
Lightmapping.OnCompletedFunctionDelegate used by Lightmapping.completed callback.
Lightmapping.OnStartedFunctionDelegate used by Lightmapping.started callback.