View difference between Paste ID: GayDUvQU and ANL4pqJC
SHOW: | | - or go back to the newest paste.
1
private void InitLightmaps( )
2
{
3
    LightmapData[] lightmapData = new LightmapData[YourlightmapNumber];
4
5
    for(int i = 0 ; i < YourlightmapNumber ; i++ )
6
        lightmapData[i] = new LightmapData();
7
8
    for( int i = 0 ; i < YourlightmapNumber ; i++ )
9
    {
10
        Debug.Log("Lightmap and path : Yourlightmapfolder/LightmapFar-" + i.ToString() ); 			
11
12
        lightmapData[i].lightmapFar = Resources.Load( "LightmapsCZC/LightmapFar-" + i.ToString(), typeof(Texture2D)) as Texture2D;
13
    }
14
    LightmapSettings.lightmaps = lightmapData;
15
}
16
17
///// Other part of code to hide lightmaps ///////
18
19
if( bIsTimeToHideLM )
20
{
21
	//Create another empty lightmapData array
22
	//Do this : LightmapSettings.lightmaps = YourNewEmptyArray
23
}
24
else
25
{
26
	//If you are here so the waiting time is over
27
	//Do this : LightSettings.lightmaps = YourTrueLightmapArray
28
}