ParticleSystem.TextureSheetAnimationModule.frameOverTime

Unity · Версия 2020.3 LTS · Scripting · TextureSheetAnimationModule

ParticleSystem.TextureSheetAnimationModule.frameOverTime

public ParticleSystem.MinMaxCurve frameOverTime;

Описание

Кривая, определяющая, какой кадр анимации листа текстуры воспроизводится.

Система использует это свойство, когда для параметра ParticleSystem.TextureSheetAnimationModule.timeMode задано значение Curve.

Смотрите так же: MinMaxCurve.

using UnityEngine;

[RequireComponent(typeof(ParticleSystem))]
public class ExampleClass : MonoBehaviour
{
    private ParticleSystem ps;

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

        var main = ps.main;
        main.startLifetimeMultiplier = 2.0f;

        var tex = ps.textureSheetAnimation;
        tex.enabled = true;
        tex.numTilesX = 4;
        tex.numTilesY = 2;

        // Простая кривая пинг-понга.
        AnimationCurve curve = new AnimationCurve();
        curve.AddKey(0.0f, 0.0f);
        curve.AddKey(0.5f, 1.0f);
        curve.AddKey(1.0f, 0.0f);

        // Применить кривую.
        tex.frameOverTime = new ParticleSystem.MinMaxCurve(1.0f, curve);
    }
}

Обновлено 17 ноября 2026 г.