SetVector(ParticleSystemCustomData, int, MinMaxCurve)
Set a ParticleSystem.MinMaxCurve, in order to generate custom data.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.ParticleSystemModule
public void SetVector(ParticleSystemCustomData stream, int component, ParticleSystem.MinMaxCurve curve)
Parameters
The name of the custom data stream to apply the curve to.
The component index to apply the curve to (0-3, mapping to the xyzw components of a Vector4 or float4).
The curve to be used for generating custom data.
Remarks
Additional Resources: ParticleSystem.CustomDataModule.GetVector, ParticleSystem.GetCustomParticleData.
Examples
using UnityEngine;using System.Collections;[RequireComponent(typeof(ParticleSystem))]public class ExampleClass : MonoBehaviour{ void Start() { ParticleSystem ps = GetComponent<ParticleSystem>(); var customData = ps.customData; customData.enabled = true; AnimationCurve curve = new AnimationCurve(); curve.AddKey(0.0f, 0.0f); curve.AddKey(1.0f, 1.0f); customData.SetMode(ParticleSystemCustomData.Custom1, ParticleSystemCustomDataMode.Vector); customData.SetVectorComponentCount(ParticleSystemCustomData.Custom1, 1); customData.SetVector(ParticleSystemCustomData.Custom1, 0, new ParticleSystem.MinMaxCurve(1.0f, curve)); }}