# SetFloat

> Set a float property.

## Definition

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

## SetFloat(string, float)

Set a float property.

```csharp
public void SetFloat(string name, float value)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the property.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The float value to set.

### Remarks

Adds a property to the block. If a float property with the given name already exists, the old value is replaced.

Additional Resources: [MaterialPropertyBlock.SetColor](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setcolor.md), [MaterialPropertyBlock.SetVector](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setvector.md), [MaterialPropertyBlock.SetMatrix](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setmatrix.md), [MaterialPropertyBlock.SetTexture](/engine/6000.6/script-reference/unityengine/materialpropertyblock/settexture.md).

## SetFloat(int, float)

Set a float property.

```csharp
public void SetFloat(int nameID, float value)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The name ID of the property retrieved by [Shader.PropertyToID](/engine/6000.6/script-reference/unityengine/shader/propertytoid.md).**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The float value to set.

### Remarks

Adds a property to the block. If a float property with the given name already exists, the old value is replaced.

Additional Resources: [MaterialPropertyBlock.SetColor](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setcolor.md), [MaterialPropertyBlock.SetVector](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setvector.md), [MaterialPropertyBlock.SetMatrix](/engine/6000.6/script-reference/unityengine/materialpropertyblock/setmatrix.md), [MaterialPropertyBlock.SetTexture](/engine/6000.6/script-reference/unityengine/materialpropertyblock/settexture.md).
