Search Unity

How to Unload Lightmaps When Additively Loading Scenes?

Discussion in 'Editor & General Support' started by Xander-Davis, Jun 18, 2013.

  1. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    441
    I'm additively loading scenes to maintain persistent variables and prefabs between them (but not full environments). However, this is maxxing out the lightmap count threshold because it's adding each scene's lightmaps each time you transition between them. How do I unload the lightmaps when I additively load another scene?
     
  2. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    441
  3. Cratesmith

    Cratesmith

    Joined:
    Aug 14, 2011
    Posts:
    137
    Just a warning. Resources.UnloadUnusedAssets terminates any running coroutines silently. Most games can't handle this one cleanly.