SetFloat
Sets the value of a float property exposed in the blackboard.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine.VFX
- Assembly: UnityEngine.VFXModule
SetFloat(int, float)
Sets the value of a float property exposed in the blackboard.
public void SetFloat(int nameID, float f)
Parameters
Remarks
Automatically changes overridden state for this property to true.
Examples
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.
public void SetFloat(string name, float f)
Parameters
Remarks
Automatically changes overridden state for this property to true.
Examples
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)); }}