General Settings

Please note that the asset has two different versions.

Lite version which only supports Built-In RP and Pro version which supports Built-In + URP + HDRP.

The manual is identical for both versions.

Editor Setup

Disable lighting "Auto Generate" option for the plugin to work properly.

If you are using Configurable Enter Play Mode, then for the plugin to work properly in playback mode, you need to check the "Reload Scene" option. Otherwise, blending will only work in edit mode.

Import MLS Package

Import the MLS package using the "Asset Store" or go to the "Assets Import Package Custom Package" menu and select the package in Windows Explorer.

If you do not need the scenes with examples and any related data, then you can exclude from the import the folders "Examples" and "Resources".

Project Setup

The plugin can work in the lightmap switching only mode without the need for a shader patch. However, keep in mind that this can cause the application to slow down, while switching lightmaps using shaders is instantaneous.

If you are using or intending to use the NGSS (Next Gen Soft Shadows) plugin, then you first need to follow the steps to install NGSS. Since NGSS patches the original CGIncludes files. This will undo the changes made by the MLS.

After importing the package, the Tools Magic Tools Magic Lightmap Switcher Prepare Shaders... tab will become available in the main editor menu.

Some users do not have administrator permissions on the PC, however, these are needed to be able to overwrite files on the system drive in the CGIncludes folder.

If the patch failed then try the following steps: (this only needs to be done once)

  1. Right click on the Hub shortcut

  2. Go to the "Properties".

  3. Go to the "Compatibility" tab and Check the "Run this program as administrator" option.

  4. Repeat the steps for the shortcut of your Unity Version.

  5. Restart your PC.

If these steps also did not help, or for some reason your shaders turned out to be corrupted, then in the Magic Lightmap Switcher ➞ Editor ➞ Dependent Resources ➞ Shader Sources ➞ Standard folder you can find archives with original and modified shaders. Just replace the shaders in the CGIncludes folder of your engine version.

This window may look slightly different depending on the rendering pipeline you are using. You need to click the "Patch..." button for the corresponding rendering pipeline.

Therefore, when you click the "Patch..." button, the system will ask you to provide administrator rights for the console. When the copy is complete, the console will wait for any key press. This will happen twice. The editor will then need to be restarted for the changes to take effect. (This only happens for Built-In RP. SRP does not require console launch)

As written in the comments in the window, the changes do not affect the basic functionality of the shaders, they only contain some extras to support real-time lightmap blending.

If the patch is successful, the button will change to "Restore...".

Deferred Mode In HDRP

Starting from the release version 1.0.0 Magic Lightmap Switcher also supports Deferred mode in HDRP.

To avoid spam errors in the console right after the shader patch, you need to add a Custom Pass Volume to the scene, which simply initializes some variables in the RP before starting rendering.

In the latest versions of the engine, a preab with this volume has already been added to the Quick Start scene, which will be imported along with the HDRP Support package. In older versions, due to differences in AssetsDatabase versions, the prefab will not be imported properly, so you have to create a Custom Pass Volume manually.

Create a new "Custom Pass" in the hierarchy:

Add the "MlsDeferredPrepass" object to the list:

Set Injection Point to "Before Rendering":

If you have problems with transparent objects, then try changing the Target Depth Buffer to Custom.

Support For Texture Arrays

Texture Arrays require a minimum shader model of 4.5, in addition, some corrections in standard and URP/HDRP Lit shaders are required for the option to work correctly. Edited versions of shaders for all RP are located in the Magic Lightmap Switcher ➞ Shaders folder

Last updated