public void SetVector (ParticleSystemCustomData stream, int component, ParticleSystem.MinMaxCurve curve);

参数

stream要向其应用曲线的自定义数据流的名称。
component要对其应用曲线的分量索引(0-3,映射到 Vector4 或 float4 的 xyzw 分量)。
curve要用于生成自定义数据的曲线。

描述

设置 MinMaxCurve 以便生成自定义数据。

using UnityEngine;
using System.Collections;

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)); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961