
Therefore, the Prefab Material Quality Loader has a preview mode. This will make it impossible to work on your scene. Once you have setup all objects of your scene to use the Prefab Material Quality Loader your scene will look like the upper image on the left. To make the loader use the custom quality level at index '0' call QL_PrefabQualityLoader.CustomQualityLevel = 0 before loading a scene or instantiating a prefab. For example, in Mad Snowboarding the ghosts of the characters are loaded with a custom quality setting. Simply add a custom quality level and provide the resource paths to your materials. You can use this script for special effects or if you don't want to use Unity's build in quality settings. If you instantiate a prefab then it will also get the right material assigned before it is drawn. If your object was already in the scene, then it will have the right material assigned before the first frame. Now create different materials for low and high quality levels in your resource folder and correct the resource path for each quality level in the QL_PrefabQualityLoader script.Īt runtime the script will check the Unity quality level and load the appropriate materials in the Awake function. Select the quality levels that you want to use and click on 'Add Quality Level'. You will see the resource path to the original material saved as a string. Your material must be placed in a resource folder, so that it can be loaded in the Awake function of the script.įoldout any of your renderers. This will guarantee that no shader or texture loading will be done unnecessarily. Your object will turn pink in the editor, because it has no materials anymore.

The script will search all renderers and remove their materials.

To setup the material quality settings for your prefab or scene object attach the QL_PrefabQualityLoader script to its root. This will prevent unnecessary texture and shader loading! BUT do not forget the textures that are linked to the materials of those shaders! For example, if the shader replacement for low quality does not use the normal texture which was assigned to the original material then the normal map texture was loaded unnecessarily! Save loading time by assigning the low quality material with less textures in the Material Quality Loader of your prefab or scene object. Loading Time Optimization: texture loading often takes a significant amount of time! However, often the shader LOD is reduced or shaders are replaced at runtime for low quality settings. You could use fast shaders for example Unlit/Texture in your low quality setting and use better shaders only for higher quality settings. If you have only one or even zero vertex lights allowed in you quality settings then you do not need lighting in your materials. FPS Optimization: increase the FPS of your low quality setting by assigning fast materials to your objects.
