Prefab Material Quality Loader

Send me a message for support
Unity Asset Store

This Prefab Material Quality Loader will load the proper materials from the Resources folder depending on the current quality settings. This way you can use a material with one texture (e.g. Diffuse) for low quality and a material with three textures (e.g. Self-Illumin/Bumped Specular) for high quality. This will make both quality settings of your game look better, run faster and load in less time. Take a look at the quality handling of Mad Snowboarding a game using this asset.

Better Visuals: define the materials for each quality level of your project individually for each prefab or scene object. This way you can improve the graphics of your low quality settings by assigning better materials to more important objects, but keep the FPS high by assigning fast materials to everything else.
FPS Optimization: increase the FPS of your low quality setting by assigning fast materials to your objects. If you have only one or even zero vertex lights allowed in you quality settings then you do not need lighting in your materials. You could use fast shaders for example Unlit/Texture in your low quality setting and use better shaders only for higher quality settings.

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. 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. This will prevent unnecessary texture and shader loading!
This asset is Unity 5 ready!

Unity Asset Store version v1.00


Prefab Material Quality Loader Inspector (How To) To setup the material quality settings for your prefab or scene object attach the QL_PrefabQualityLoader script to its root. The script will search all renderers and remove their materials. Your object will turn pink in the editor, because it has no materials anymore. This will guarantee that no shader or texture loading will be done unnecessarily. Your material must be placed in a resource folder, so that it can be loaded in the Awake function of the script.

Foldout any of your renderers. You will see the resource path to the original material saved as a string. Select the quality levels that you want to use and click on 'Add Quality Level'. 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.

At runtime the script will check the Unity quality level and load the appropriate materials in the Awake function. If your object was already in the scene, then it will have the right material assigned before the first frame. If you instantiate a prefab then it will also get the right material assigned before it is drawn.
You can use this script for special effects or if you don't want to use Unity's build in quality settings. Simply add a custom quality level and provide the resource paths to your materials. For example, in Mad Snowboarding the ghosts of the characters are loaded with a custom quality setting. 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.

Prefab Material Quality Loader Preview 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. This will make it impossible to work on your scene. Therefore, the Prefab Material Quality Loader has a preview mode. To use it foldout 'Quality Preview' and click on 'Add/Replace Preview Materials'. This will add the removed materials to the selected object or the whole scene. However, don't forget to remove those materials with the 'Remove Preview Materials' button. If you forget to remove those, then you will see an error message when you start your scene. Removing these materials is important to keep the performance gain that the Prefab Material Quality Loader provides.


Code does not compile. With errors like:
"error CS0246: The type or namespace name `QL_PrefabQualityLoader' could not be found. Are you missing a using directive or an assembly reference?"
To avoid conflicts with your code the tool has its own namespace. Add the namespace by placing this line at the top of your code file:
"using QL_QualityLoader;"