# SetFloat

> Sets the value of a float property exposed in the blackboard.

## Definition

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

## SetFloat(int, float)

Sets the value of a float property exposed in the blackboard.

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

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The ID of the property. This is the same ID that [Shader.PropertyToID](/engine/6000.6/script-reference/unityengine/shader/propertytoid.md) returns.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The new float value.

### Remarks

Automatically changes overridden state for this property to true.

### Examples

```csharp
using UnityEngine;
using UnityEngine.VFX;

class SetFloatExample : MonoBehaviour
{
    [SerializeField] VisualEffect m_Vfx;
    [SerializeField] float m_Frequency = 1f;
    [SerializeField] float m_Phase = 0f;

    static readonly int k_MyValuePropertyNameID = Shader.PropertyToID("MyValueProperty");

    void Update()
    {
        m_Vfx.SetFloat(k_MyValuePropertyNameID, Mathf.Cos(Time.time * m_Frequency + m_Phase));
    }
}
```

## SetFloat(string, float)

Sets the value of a float property exposed in the blackboard.

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

### 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 new float value.

### Remarks

Automatically changes overridden state for this property to true.

### Examples

```csharp
using UnityEngine;
using UnityEngine.VFX;

class SetFloatExample : MonoBehaviour
{
    [SerializeField] VisualEffect m_Vfx;
    [SerializeField] float m_Frequency = 1f;
    [SerializeField] float m_Phase = 0f;

    static readonly int k_MyValuePropertyNameID = Shader.PropertyToID("MyValueProperty");

    void Update()
    {
        m_Vfx.SetFloat(k_MyValuePropertyNameID, Mathf.Cos(Time.time * m_Frequency + m_Phase));
    }
}
```
