# SetPropertyLock

> Sets the lock state of a property for this material.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

## SetPropertyLock(int, bool)

Sets the lock state of a property for this material.

```csharp
public void SetPropertyLock(int nameID, bool value)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Property name ID, use [Shader.PropertyToID](/engine/6000.7/script-reference/unityengine/shader/propertytoid.md) to get it.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): The desired lock state.

### Remarks

If a property is locked by the material, any Material Variant inheriting from this Material will be unable to change the value of the property. Note that this method is Editor-only.

Additional Resources: GetPropertyLock, [Material.IsPropertyLockedByAncestor](/engine/6000.7/script-reference/unityengine/material/ispropertylockedbyancestor.md).

## SetPropertyLock(string, bool)

Sets the lock state of a property for this material.

```csharp
public void SetPropertyLock(string name, bool value)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Property name, e.g. "\_SrcBlend".**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): The desired lock state.

### Remarks

If a property is locked by the material, any Material Variant inheriting from this Material will be unable to change the value of the property. Note that this method is Editor-only.

Additional Resources: GetPropertyLock, [Material.IsPropertyLockedByAncestor](/engine/6000.7/script-reference/unityengine/material/ispropertylockedbyancestor.md).
