Version: 2021.1
LanguageEnglish
  • C#

ParticleSystem.TextureSheetAnimationModule.speedRange

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 Vector2 speedRange;

Description

Specify how particle speeds are mapped to the animation frames.

If a particle is travelling slower than the minimum speed, it uses the first frame. If a particle is travelling faster than the maximum speed, then it uses the final frame. For all other speeds, the particle chooses a frame based on how far between the minimum and maximum value its speed is.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { private ParticleSystem ps;

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

var textureSheetAnimation = ps.textureSheetAnimation; textureSheetAnimation.enabled = true; textureSheetAnimation.speedRange = new Vector2(0.9f, 5.0f); } }