# InvalidOperationException: ParticleSystem.CustomDataModule.SetVector: custom data index 1 is out of range (max 2)

- **ID:** `unity/particle-system-culling-error`
- **Domain:** unity
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

Attempting to access a custom data stream index that exceeds the enabled count in the ParticleSystem's CustomDataModule.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 2022.3.5f1 | active | — | — |
| 2023.1.2f1 | active | — | — |
| 2021.3.25f1 | active | — | — |

## Workarounds

1. **In Inspector, select ParticleSystem, expand CustomDataModule, ensure 'Custom1' and 'Custom2' are enabled (checkboxes). In script, use GetCustomDataModule to verify enabled streams: var cdm = ps.customData; if (cdm.enabled && cdm.GetMode(ParticleSystemCustomData.Custom1) != ParticleSystemCustomDataMode.Disabled) { cdm.SetVector(ParticleSystemCustomData.Custom1, 0, vec); }** (95% success)
   ```
   In Inspector, select ParticleSystem, expand CustomDataModule, ensure 'Custom1' and 'Custom2' are enabled (checkboxes). In script, use GetCustomDataModule to verify enabled streams: var cdm = ps.customData; if (cdm.enabled && cdm.GetMode(ParticleSystemCustomData.Custom1) != ParticleSystemCustomDataMode.Disabled) { cdm.SetVector(ParticleSystemCustomData.Custom1, 0, vec); }
   ```
2. **Set custom data index to 0 (first stream) if only one stream is needed: cdm.SetVector(ParticleSystemCustomData.Custom1, 0, vector);** (85% success)
   ```
   Set custom data index to 0 (first stream) if only one stream is needed: cdm.SetVector(ParticleSystemCustomData.Custom1, 0, vector);
   ```

## Dead Ends

- **Increasing the index value in code** — The error is about index out of range; increasing index makes it worse. (90% fail)
- **Disabling CustomDataModule entirely** — Removes custom data functionality but may break intended effects. (50% fail)
