These instructions explain how to work with Material Variants.
Programmers should consult the MaterialAn asset that defines how a surface should be rendered. More info See in Glossary and MaterialEditor API documentation for information about how to work with Material Variants in scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info See in Glossary.
Differences between Prefab Variants and Material Variants
The Material Variant workflow is mostly the same as the Prefab Variant workflow. There are two key differences:
You can lock one or more Properties of a Material Variant so that no one can edit these Properties in its children
It is possible to change the parent of a Material Variant
Create a Material Variant
There are two ways to create a Material Variant.
Right-click on a Material in the Project window
Select a Material in the Project windowA window that shows the contents of your Assets folder (Project tab) More info See in Glossary.
Right-click on that Material.
Select Create > Material Variant.
Select in the Material Hierarchy
Open the Material Hierarchy dialog.
Select the material type dropdown.
Select Material Variant.
Assign a material to the parent field
Identify the new Material Variant
When you create a new Material Variant, it has the name [Material Name] Variant (Material Variant) in the Material InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info See in Glossary. When Unity begins to load a new Material Variant, the Material Variant has a striped icon in the Project window. After Unity finishes loading the new Material Variant, the normal Material preview replaces the striped icon in the Project window.
Add an Override on a Material Variant
Select a Material Variant.
Modify one of its Properties in the Material Inspector.
Revert one or more Overrides on a Material Variant
Right-click on an Override.
Select Revert to revert this specific Override, or select Revert all Overrides to revert every Override on this variant. If this Override originated from a child, reverting also applies to that child.
Select the Material Variant in the Project window.
Press the Delete key.
The next step depends on whether the Material Variant has children.
If the Material Variant has no children, click Delete in the warning dialog to delete the variant.
If the Material Variant has one or more children, a warning dialog appears that says One or more of these Material(s) has one or more children. Would you like you reparent all of these children to their closest remaining ancestor?
The warning dialog provides three options:
Delete and reparent children: This option causes Unity to automatically assign this parent’s children to their closest ancestor; this new parent can be either a Material Variant or a Material, or no parent if the Material to be deleted is the root of the hierarchy.
Delete only Note: A Material with a missing parent is in an invalid state and will not load correctly at runtime.
PrefabsAn asset type that allows you to store a GameObject complete with components and properties. The prefab acts as a template from which you can create new object instances in the scene. More info See in Glossary