Search Unity

Stop/Pause Spawning Particle after a Prewarn Spawning.

Discussion in 'Visual Effect Graph' started by franck_Extriple, Sep 30, 2021.

  1. franck_Extriple

    franck_Extriple

    Joined:
    Oct 27, 2017
    Posts:
    20
    Hi,

    i'm currently using Unity VFX graph to load and show off Scan Data. I've followed some guidelines from PCX system on Github for that.

    I like to spawn things at start, but i wanted to prewarm the spawning and then just pause it.

    Unfortunately i can't find a block or script that can just Pause the spawning value after OnPlay.

     
  2. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    Hi! Can you use a Single Burst block in your Spawner? It will spawn all the particles at once, and then you can still prewarm if they need to move/do something over time.
     
  3. franck_Extriple

    franck_Extriple

    Joined:
    Oct 27, 2017
    Posts:
    20
    Thanks.
    Tested without success Vlad,
    but in the meantime, i've found a way to pause the spawning, via this Thread code:
    https://forum.unity.com/threads/what-is-the-right-way-to-pause-particles.837889/

    i will test again your advice, on an empty scene with new VFX Graph item. (to track down my mistake)


    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.VFX;
    3. public class AdjustVFXSpeed : MonoBehaviour
    4. {
    5.     [SerializeField] float timeScale = 1.0f;
    6.     [SerializeField] VisualEffect VFX;
    7.     void Start()
    8.     {
    9.         VFX = GetComponent<VisualEffect>();
    10.     }
    11.     void Update()
    12.     {
    13.         VFX.playRate = timeScale;
    14.     }
    15. }