How to bake Adaptive Probe Volume by Editor script

So, I have level design generator. And my level design production pipeline is simple. Now I need to automate (add logic to my current editor script) this logic: Open lighting tab, set mode to “Baking set” → selecting game object that holds all level design elements->in APV press “Fit to Selection”-> press Bake . Can someone tell me public static methods to automate this process?

There’s AdaptiveProbeVolumes.BakeAsync() to kick off a bake of just APV, or Lightmapping.BakeAsync() to bake everything. ProbeReferenceVolume.instance.SetActiveBakingSet() can be used to set the current baking set.

You can configure the size of the probe volume using ProbeVolume.size and ProbeVolume.transform.position. I’m afraid there’s no way to “fit to selection” from script, but you can check how it’s done in ProbeVolumeUI.Drawer_BakeToolBar.

ProbeVolumeBakingSet is a scriptable object, so you can create a new instance of it using ScriptableObject.CreateInstance().

Hope some of that helps.