Messing with VFX Graph time scale/playback rate

Unity Forum user Olmi did a nice code snippet for this

https://forum.unity.com/threads/what-is-the-right-way-to-pause-particles.837889/


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.VFX;

public class vfxgraph_playrate : MonoBehaviour
{
    [SerializeField] float timeScale = 1.0f;
    [SerializeField] VisualEffect VFX;

    void Start()
    {
        VFX = GetComponent<VisualEffect>();
    }

    void Update()
    {
        VFX.playRate = timeScale;
    }
}

NEAT AS HECK. WHY ISN'T THIS A NODE IN VFX GRAPH?

Comments

Popular posts from this blog

Unity's "new" input system and Keijiro's Minis midi stuff

compute shader with skinned mesh flocking instances

setting VFX graph properties using C#