---
title: SetColor(ParticleSystemCustomData, MinMaxGradient)
product: Unity Editor
version: '6000.3'
latest_version: '7000.0'
status: This page documents version 6000.3. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/6000.3/script-reference/unityengine/particlesystem/customdatamodule/setcolor
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unityengine/particlesystem/customdatamodule/setcolor.md
last_updated: 2026-09-14
generated_at: 2026-11-08T04:24:00.180Z
locale: en-us
---

# SetColor(ParticleSystemCustomData, MinMaxGradient)

> Set a ParticleSystem.MinMaxGradient, in order to generate custom HDR color data.

## Definition

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

```csharp
public void SetColor(ParticleSystemCustomData stream, ParticleSystem.MinMaxGradient gradient)
```

### Parameters

**** (\[ParticleSystemCustomData]\(/engine/6000.3/script-reference/unityengine/particlesystemcustomdata)): The name of the custom data stream to apply the gradient to.**** (\[MinMaxGradient]\(/engine/6000.3/script-reference/unityengine/particlesystem/minmaxgradient)): The gradient to be used for generating custom color data.

### Remarks

Additional Resources: [ParticleSystem.CustomDataModule.GetColor](/engine/6000.3/script-reference/unityengine/particlesystem/customdatamodule/getcolor.md), [ParticleSystem.GetCustomParticleData](/engine/6000.3/script-reference/unityengine/particlesystem/getcustomparticledata.md).

### Examples

```csharp
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);
    }
}
```
