# Sandbox.SceneObject.SetMaterialOverride

## Overload 1

```csharp
void SetMaterialOverride(Material material)
```

Override all materials on this object's [Sandbox.SceneObject.Model](/api/Sandbox.SceneObject/Model).

### Parameters

- `material` (`Material`)

## Overload 2

```csharp
void SetMaterialOverride(Material material, string attributeName, int attributeValue = 1)
```

Replaces all materials of the model that have the given User Material Attribute set to "1", with given material.
            
The system checks both the models' default material group materials and the materials of the active material group.

### Parameters

- `material` (`Material`): Material to replace with.
- `attributeName` (`string`): Name of the User Material Attribute to test on each material of the model. They are set in the Material Editor's Attributes tab.
- `attributeValue` (`int`), default `1`: Value of the attribute to test for.

Declared in [Sandbox.SceneObject](/api/Sandbox.SceneObject).
Assembly: `Sandbox.Engine`.
