API
Magic Lightmap Switcher provides a simple set of APIs for controlling scene lighting and loading and unloading in multi-scene mode.
Scene Loading/Unloading
Please note that loading and unloading scenes requires special mechanics, which are implemented in the plugin API.
You can use your own scene manager and your own logic, but you should definitely call methods from the plugin API for loading and unloading scenes if you need the plugin mechanics to work correctly.
LoadSceneAdditive()
To load the scene additively, call the SceneManagment.LoadSceneAdditive() method.
In the example below, the method is called on the OnTriggerEnter() event.
UnloadScene()
To unload the scene, call the SceneManagment.UnloadScene() method.
In the example below, the method is called on the OnTriggerEnter() event.
Switching/Blending
The RuntimeAPI class contains methods for switching and blending lightmaps. Each scene must have its own instance of this class.
BlendLightmapsCyclic()
Call Blending.BlendLightmapsCyclic() to start blending lightmaps cyclic in real time. This triggers a sequential transition between all lightmaps in the Lighting Scenario from the first to the last and then jumps back to the first.
Below is an example of a simple method call that starts the cyclic blending of lightmaps.
BlendLightmapsPingPong()
This method blend lightmaps in Lighting Scenario in a ping-pong style, i.e. from first to last and in reverse order. The parameters and calling code are exactly the same as those for BlendLightmapsCyclic().
SwitchLightmap()
To instantly switch lightmaps to a specific index in a scenario, call the RuntimeAPI.SwitchLightmap() method.
In the example below, the method is called on the OnTriggerEnter() event.
Last updated