Legacy Documentation: Version 2017.1 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

ParticleSystem.CustomDataModule.SetVectorComponentCount

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public function SetVectorComponentCount(stream: ParticleSystemCustomData, count: int): void;
public void SetVectorComponentCount(ParticleSystemCustomData stream, int count);

Parameters

stream The name of the custom data stream to apply the curve to.
curveCount The number of curves to generate data for.

Description

Specify how many curves are used to generate custom data for this stream.

#pragma strict
function Start() {
	var ps: ParticleSystem = GetComponent.<ParticleSystem>();
	var customData: var = ps.customData;
	customData.enabled = true;
	var curve: AnimationCurve = 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));
}
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)); } }

Did you find this page useful? Please give it a rating: