Search Unity

Light Maps / LoadLevelAdditive / Prefab

Discussion in 'General Graphics' started by bansheesoft, Apr 27, 2015.

  1. bansheesoft

    bansheesoft

    Joined:
    Oct 3, 2014
    Posts:
    62
    My game needs the ability to load rooms from either load level additive or better prefabs. I need to use the light mapping features. Once I attempt to load level additive a disabled level or prefab so I can position and rotate it then enable it the light maps are there but not functioning properly. What is the correct way to do this? They will share light maps correct?

    I need to be able to position and rotate the rooms at run time to randomly construct a level.

    I have been wrestling with and fighting this for quite some time and thanks for any help!

    Also asked here with no answer as of yet:
    http://answers.unity3d.com/questions/953848/light-maps-loadleveladditive-prefab.html
     
  2. bansheesoft

    bansheesoft

    Joined:
    Oct 3, 2014
    Posts:
    62
    Bump sorry I am stumped here...
     
  3. bansheesoft

    bansheesoft

    Joined:
    Oct 3, 2014
    Posts:
    62
    OK to expound on the subject.

    Here is a level...

    Right side has the light map.. left side which i created by instantiating the right side. As you can see the light-maps are not working on the left..

    Right: Load Level Additive



    Left: Instantiate ( Right )




    I need to load a level with load level additive... then copy it to a new location and enable it.. everything even batching is working but light maps are not... What do I need to do to make the instantiation use the same light-maps as the gameobject it was copied from?

    Thanks so much for any help this has stopped my progress....

    Thanks so much!
     
  4. bansheesoft

    bansheesoft

    Joined:
    Oct 3, 2014
    Posts:
    62
    What I found and the order to proceed in generating a level randomly.

    - LoadLevelAdditive the room.

    - Be sure to make it active so you can run down its tree.

    - Instantiate the room at its new position and rotation.

    - Set it to active at this point

    - Run down both trees (New and Original) and copy over the lightmapIndex AND the lightmapOffsetScale to the new game object.

    - To allow for batching then run down the new room and get a count of meshes

    - put all the meshes in one array and send it to the static batch utility.

    - Delete the template rooms

    - Clean up unused assets.

    - Smash face in keyboard as the method to do all this has to be figured out over DAYS...

    I sure hope this helps someone else!