Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Baking APV via script(for batchmode CI)

Discussion in 'Graphics Experimental Previews' started by thelebaron, Mar 29, 2024.

  1. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    865
    How are we supposed to do this? With lightmapping, its as simple as
    Lightmapping.Bake()
    . I don't want to mess around with settings, ideally just use the scene's settings and bake. Theres a post on the beta forum for feedback about the new probe baking api, that has this as an example of how to use it, but it feels incredibly unclear for my use case.

    Note I did try reflection to access what the editor button does, but this doesn't work in batchmode.
    Code (CSharp):
    1. var probeGIBakingType = typeof(AdaptiveProbeVolumes);
    2. var bakeGI            = probeGIBakingType.GetMethod("BakeAsync", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
    3. bakeGI.Invoke(null, null);