Search Unity

Question Hidden Delay on Constant Respawn?

Discussion in 'Visual Effect Graph' started by TeKniKo64, Apr 1, 2022.

  1. TeKniKo64

    TeKniKo64

    Joined:
    Oct 7, 2014
    Posts:
    30
    Anyone know why there is always a one second delay between my Constant Spawn Rate which is set to 1? The expected result is one spawned particle per second, instead I am seeing one particle spawn for one second, then a wait one second, then repeat. Is there some sort of hidden delay?

    Thank you,
    TeKniKo
     
  2. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,307
    There is no delay, this is just how this block works. It spawns X particles per second, so if you want 1 particle per second, then you need to wait 1 second to get 1 particle. It does something like this:
    Code (CSharp):
    1. float particlesToSpawn += Time.deltaTime * rate;
    2. // Then try to spawn number of particles = [spawnCount]
    3. float spawnCount = Math.Floor(particlesToSpawn);
    4. particlesToSpawn -= spawnCount;
    It must accumulate enough time to spawn particle.