ParticleSystem.CustomDataModule.SetVector
Declaration
public void SetVector(ParticleSystemCustomData stream, int component, ParticleSystem.MinMaxCurve curve);Параметры
| Параметр | Описание |
|---|---|
| поток | Имя пользовательского потока данных, к которому будет применена кривая. |
| компонент | Индекс компонента, к которому будет применена кривая (0-3, отображение на компоненты xyzw Vector4 или float4). |
| кривая | Кривая, используемая для создания пользовательских данных. |
Описание
Установите MinMaxCurve, чтобы генерировать пользовательские данные.
Дополнительные ресурсы: ,ParticleSystem.CustomDataModule.GetVector,, ,ParticleSystem.GetCustomParticleData,.
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)); } }