Version: 2017.4
LanguageEnglish
  • C#
  • JS

Script language

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

ParticleSystem.VelocityOverLifetimeModule.speedModifierMultiplier

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 var speedModifierMultiplier: float;
public float speedModifierMultiplier;

Description

Speed multiplier.

This method is more efficient than accessing the whole curve, if you only want to change the overall speed multiplier.

#pragma strict
private var ps: ParticleSystem;
public var hSliderValueSpeed: float = 1.0f;
function Start() {
	ps = GetComponent.<ParticleSystem>();
	var velocityOverLifetime: var = ps.velocityOverLifetime;
	velocityOverLifetime.enabled = true;
	velocityOverLifetime.space = ParticleSystemSimulationSpace.World;
	var curve: AnimationCurve = new AnimationCurve();
	curve.AddKey(0.0f, 0.0f);
	curve.AddKey(1.0f, 1.0f);
	var minMaxCurve: ParticleSystem.MinMaxCurve = new ParticleSystem.MinMaxCurve(1.0f, curve);
	velocityOverLifetime.speedModifier = minMaxCurve;
}
function Update() {
	var velocityOverLifetime: var = ps.velocityOverLifetime;
	velocityOverLifetime.speedModifierMultiplier = hSliderValueSpeed;
}
function OnGUI() {
	GUI.Label(new Rect(25, 40, 100, 30), "Speed");
	hSliderValueSpeed = GUI.HorizontalSlider(new Rect(55, 45, 100, 30), hSliderValueSpeed, -50.0f, 50.0f);
}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { private ParticleSystem ps; public float hSliderValueSpeed = 1.0f;

void Start() { ps = GetComponent<ParticleSystem>();

var velocityOverLifetime = ps.velocityOverLifetime; velocityOverLifetime.enabled = true; velocityOverLifetime.space = ParticleSystemSimulationSpace.World;

AnimationCurve curve = new AnimationCurve(); curve.AddKey(0.0f, 0.0f); curve.AddKey(1.0f, 1.0f);

ParticleSystem.MinMaxCurve minMaxCurve = new ParticleSystem.MinMaxCurve(1.0f, curve);

velocityOverLifetime.speedModifier = minMaxCurve; }

void Update() { var velocityOverLifetime = ps.velocityOverLifetime; velocityOverLifetime.speedModifierMultiplier = hSliderValueSpeed; }

void OnGUI() { GUI.Label(new Rect(25, 40, 100, 30), "Speed");

hSliderValueSpeed = GUI.HorizontalSlider(new Rect(55, 45, 100, 30), hSliderValueSpeed, -50.0f, 50.0f); } }