Documentation

Unity Engine

Unity Engine

GenerateInBackground()

Starts baking static occlusion culling data for the loaded scenes in the background.
Read time 1 minuteLast updated 5 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule
Warning
Deprecated. StaticOcclusionCulling is deprecated and will be removed in a future release. Consider migrating to GPU Occlusion Culling where your target platform supports it. #from(6000.7)
public static bool GenerateInBackground()

Returns

Type

Description

boolReturns
true
if the bake started. Returns
false
if the bake can't start, for example if the loaded scenes contain no static renderers or static terrains.

Remarks

This method returns immediately. Use StaticOcclusionCulling.isRunning to check whether the bake is still running, and StaticOcclusionCulling.Cancel to stop it. When the bake finishes, Unity saves the result as an occlusion culling data asset and assigns it to the loaded scenes. Opening a scene, entering Play mode, or quitting the Editor cancels the bake.
If a static renderer or occlusion portal included in the bake is destroyed before the bake finishes, Unity discards the result and logs a warning. This happens, for example, when a build reloads the open scenes. If a script needs the occlusion data before it continues, for example in a build callback, use StaticOcclusionCulling.Compute instead.