L
L
LittleBob2021-10-22 18:31:33
Unity
LittleBob, 2021-10-22 18:31:33

How to change particle speed in Unity via script?

Every 10 seconds I need to change the particle speed (Start Speed ​​value). Repetitions can be done through a coroutine, this is understandable, but I have absolutely no idea how to change this value through a script.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
KraGen.Developer, 2021-10-22
@LittleBob

Here you go

private ParticleSystem ps;//ваша система частиц
    public float Value = 1.0F;//типа скорость которую через корутину меняете

    void Start()
    {
        ps = GetComponent<ParticleSystem>();//получаем систему частиц
    }

    void Update()
    {
        var main = ps.main;//хз что но оно надо (не разбирал)
        main.startSpeed = Value;//начальная скорость равна значению
    }
//корутину сделайте сами)

Source - TYK

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question