Description
The SetMaterialOverride
method allows you to override a specific material on a model based on a given attribute. This is particularly useful when dealing with models that have multiple materials, and you want to change only one of them that matches a specific attribute.
Usage
To use the SetMaterialOverride
method, you need to provide a Material
object that you want to use as the override and a string
representing the target attribute. The method will apply the override to the material that has the specified attribute set.
Example
// Assume 'modelRenderer' is an instance of ModelRenderer
// and 'newMaterial' is an instance of Material
// Override the material with the attribute 'skin' set to '1'
modelRenderer.SetMaterialOverride(newMaterial, "skin");