Version: 2023.1
public void SetVectorComponentCount (ParticleSystemCustomData stream, int count);

参数

stream 要向其应用曲线的自定义数据流的名称。
curveCount 要为其生成数据的曲线数。

描述

指定用于为此流生成自定义数据的曲线数。

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