Search Unity

Material Variants: The solution for managing complex material libraries

Different color Unity logo spheres on a shelf
Different color Unity logo spheres on a shelf

Is this article helpful for you?

Thank you for your feedback!

Ever wanted to automatically apply changes from one material to multiple others? Or to reuse a Base Material for local tweaks? In Unity 2022.1, we’re introducing a concept similar to Prefabs, compatible with all render pipelines, to manage Material Variants in the Editor.

Get ready for Material Variants

Made for teams or individual creators managing several materials at once, Material Variants can improve collaboration, facilitate the reusability of materials, speed up iterations, and enhance asset libraries with smooth updates and reduced risk of error. This highly requested solution enables the reuse and refined management of materials that share most surface properties but differ through others.

Material Variants hierarchy settings in Unity
Browsing the Material Variant hierarchy

With Material Variants, you can create templates or Material Prefabs based on regular materials. This results in variants that share common properties with the template material and override the properties that differ.

Smoothness Override in a child material
Smoothness Override in a child material

Changing common and non-overridden properties in the template material is then automatically reflected in the variant materials. You can also lock certain properties in a material to prevent them from being overridden in the variants.

Lock the material’s properties to prevent them from being overridden in the variants.
Lock the material’s properties to prevent them from being overridden in the variants.

As an example, you can set up the variation hierarchy of wood materials in your project this way:


  • Oak: Different texture but same smoothness/metallic properties as Wood
    • White Oak: Same as Oak material with a different Base Color tint
    • Red Oak: Same as Oak material with a different Base Color tint
  • Cherry: Different texture but same smoothness/metallic properties as Wood

When changing the smoothness/metallic properties in the Wood material, modifications are automatically reflected in all materials in the hierarchy.

Refined reusability for faster iteration

Here are three key benefits of Material Variants:

  • Better reusability: Efficiently build a library of Base Materials shared across projects, then override them in specific projects or scenes.
  • Safe and speedy iteration at scale: On midsize to large projects with many materials and multiple artists, Material Variants save you the pain of copying all materials whenever tweaks are needed in a scene or per instance. This way, artists don’t have to keep track of duplicate materials to prevent them from introducing visual bugs, such as those caused by forgetting to make (or revert) changes on the related materials or using another shader that could affect performance.
  • Shader Graph materials for greater efficiency: When creating variants from materials autogenerated by a Shader Graph shader, with default values set in the graph blackboard automatically propagated to all children variants, you can edit Base Material properties directly from Shader Graph, and even leverage real-time visualization in the scene when modifying values through the blackboard.

So, how does this work?

Material Variants are regular Material Assets that store references to their parents, in addition to the list of overridden parameters. To guarantee strong performance in-Editor, inherited values are cached, and hierarchies are only resolved once a material is accessed and one of its parents has changed since the last resolve.

Unlike Prefabs, Material Variants don’t rely on the Asset Database to maintain hierarchies. When a change occurs in a hierarchy, there is no need to internally reimport the children materials; only children loaded in memory will be updated with newly inherited values, prompting faster iteration.

Please note, however, that the concept of Material Variants is only available in the Editor to improve material authoring workflows. It has no impact at runtime, and does not serve to optimize overall runtime performance. It can be used to author different materials across different platforms, so long as they use the same shader. Since only one shader is allowed per Material Variant hierarchy, you cannot set a specific shader at a given level to target a particular platform. Nonetheless, you can use Material Variants to edit Material properties or enable a specific keyword when targeting a platform.

Working with Material Variants from script

Material Variants don’t inherit keywords from their parents. This is because the keyword state often depends on the value of other properties. For example, a keyword might only be set when a texture is assigned to the material. To support this workflow, we’ve added a new API to the ShaderGUI class called ValidateMaterial. This method is called every time a material using the ShaderGUI is modified, or when its hierarchy is resolved in the case of a Material Variant. This helps to ensure that the keyword state is up to date.

Finally, if you’re looking to create custom GUI for fields in the Material Inspector, there’s now a pair of functions added, similar to existing functions for Prefabs: BeginProperty and EndProperty. Wrapping custom GUI code for a property between these calls will display lock icons in Unity and context menus for Material Variants.

How to get started

To use Material Variants, you must be working in Unity 2022.1 or above.

Material Variants are compatible with existing materials. To create a variant of an existing material, go to your Project window, right-click on the Material Asset and choose Create > Material Variant. You can also convert an existing material into a Material Variant. This is useful if you already have duplicate materials and want to reparent them to a common parent material with the new workflow in your project.

Additionally, you can lock some properties in the parent material to prevent the child material from modifying them (i.e., Surface Options), modify properties in the child that won’t affect the parent material (i.e., Base Map color), and modify the parent to apply some changes that need to be applied to all children materials (i.e., a new Base Map texture).

At any point, you can check the Material Variant hierarchy to verify the impact of changes made at any level or that you’re making changes at the right level of the hierarchy. Material Variants offer plenty of useful functionalities like reparenting, reverting, or applying overrides upward. To learn more, read our documentation here.

What’s next

We have yet to plan for any new features at this stage, and are currently concentrating on stability. You can share your feedback with us or ask questions on our dedicated Unity forum thread.

Once you’ve tinkered with the system, please take a few minutes to fill out our survey, as this will help us validate the quality of our initial design. To propose new features and vote for upcoming features under consideration, check out our public roadmaps available here.

Is this article helpful for you?

Thank you for your feedback!

Related Posts