SetColor(ParticleSystemCustomData, MinMaxGradient)
Set a ParticleSystem.MinMaxGradient, in order to generate custom HDR color data.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.ParticleSystemModule
public void SetColor(ParticleSystemCustomData stream, ParticleSystem.MinMaxGradient gradient)
Parameters
The name of the custom data stream to apply the gradient to.
The gradient to be used for generating custom color data.
Remarks
Additional Resources: ParticleSystem.CustomDataModule.GetColor, 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; Gradient grad = new Gradient(); grad.SetKeys(new GradientColorKey[] { new GradientColorKey(Color.blue, 0.0f), new GradientColorKey(Color.red, 1.0f) }, new GradientAlphaKey[] { new GradientAlphaKey(1.0f, 0.0f), new GradientAlphaKey(0.0f, 1.0f) }); customData.SetMode(ParticleSystemCustomData.Custom1, ParticleSystemCustomDataMode.Color); customData.SetColor(ParticleSystemCustomData.Custom1, grad); }}