private void OnGUI()
 {
     if (GUILayout.Button("BakeMain"))
     {
         worldState = WorldState.Main;
         SetBakeDirectionLight(true);
         Lightmapping.BakeAsync();
     }
     if (GUILayout.Button("BakeOther"))
     {
         worldState = WorldState.Other;
         SetBakeDirectionLight(true);
         Lightmapping.BakeAsync();
     }
     if (GUILayout.Button("ShowMain"))
     {
         worldState = WorldState.Main;
         SetBakeDirectionLight(false);
         LightMapTool.ApplyLightmaps(false);
     }
     if (GUILayout.Button("ShowOther"))
     {
         worldState = WorldState.Other;
         SetBakeDirectionLight(false);
         LightMapTool.ApplyLightmaps(true);
     }
     mainLight = EditorGUILayout.ObjectField("main light",
                                             mainLight,
                                             typeof(Light),
                                             true) as Light;
     otherLight = EditorGUILayout.ObjectField("other light",
                                              otherLight,
                                              typeof(Light),
                                              true) as Light;
 }
 private void OnBakeCompleted()
 {
     LightMapTool.CopyLightmapsData(worldState == WorldState.Other ? true : false,
                                    worldState == WorldState.Other ? otherLight : mainLight);
     LightMapTool.ClearBakeData();
     SetBakeDirectionLight(false);
     LightMapTool.ApplyLightmaps(worldState == WorldState.Other ? true : false);
     Debug.Log("BakeComplete");
 }