{
  "id": "unity/particle-system-culling-error",
  "signature": "InvalidOperationException: ParticleSystem.CustomDataModule.SetVector: custom data index 1 is out of range (max 2)",
  "signature_zh": "无效操作异常：ParticleSystem.CustomDataModule.SetVector：自定义数据索引1超出范围（最大2）",
  "regex": "InvalidOperationException: ParticleSystem\\.CustomDataModule\\.SetVector: custom data index \\d+ is out of range \\(max \\d+\\)",
  "domain": "unity",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Attempting to access a custom data stream index that exceeds the enabled count in the ParticleSystem's CustomDataModule.",
  "root_cause_type": "generic",
  "root_cause_zh": "尝试访问的自定义数据流索引超过了ParticleSystem的CustomDataModule中启用的数量。",
  "versions": [
    {
      "version": "2022.3.5f1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "2023.1.2f1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "2021.3.25f1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increasing the index value in code",
      "why_fails": "The error is about index out of range; increasing index makes it worse.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Disabling CustomDataModule entirely",
      "why_fails": "Removes custom data functionality but may break intended effects.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "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); }",
      "success_rate": 0.95,
      "how": "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); }",
      "condition": "",
      "sources": []
    },
    {
      "action": "Set custom data index to 0 (first stream) if only one stream is needed: cdm.SetVector(ParticleSystemCustomData.Custom1, 0, vector);",
      "success_rate": 0.85,
      "how": "Set custom data index to 0 (first stream) if only one stream is needed: cdm.SetVector(ParticleSystemCustomData.Custom1, 0, vector);",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "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); }",
    "Set custom data index to 0 (first stream) if only one stream is needed: cdm.SetVector(ParticleSystemCustomData.Custom1, 0, vector);"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.unity3d.com/ScriptReference/ParticleSystem.CustomDataModule.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.92,
  "resolvable": "true",
  "first_seen": "2023-06-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}