Search Unity

Question Play() and Stop()

Discussion in 'Visual Effect Graph' started by bartuq, Dec 14, 2022.

  1. bartuq

    bartuq

    Joined:
    Sep 26, 2016
    Posts:
    127
    If I use Play() or Stop() my vfx effect is delayed. Any idea why? I have a pushable object with a dust effect and it looks weird if it doesn't start immediately and stop when my object stops.

    Spawn System: Constant Spawn Rate 3
     
  2. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,307
    Constant spawn rate emits X particles per second, in your case 3. This means you need to accumulate 1/3 of second for the first particle, 2/3 for second and last one is after one second. You can use additional single burst when event starts to spawn particle at the beggining or change it to looping or use periodic burst, really depends what you need.
     
  3. bartuq

    bartuq

    Joined:
    Sep 26, 2016
    Posts:
    127
    What I want to achive: LINK

    I have Play() at the beginning of coroutine and Stop() at the end of it when pushable object changes its position. It looks almost the same as in the video but both methods are delayed which I want to fix.

    I tried changing the Rate to a higher number for example 1000 and the Capacity to 3 but it still delayed. Maybe I'm doing something wrong.

    My vfx graph:
    vfx_graph.png
     
  4. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,307
    You can keep spawn over time (only) and create separate spawner that runs once (single burst) when you trigger the event, or when you click the spawn context you can see some additional settings in inspector. This way you can setup it in any way you want. I am pretty sure there was thread with exactly the same problem somewhere.
    Alternative way is to handle spawning by your script with direct link.