Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Feature Request VFX Graph Trigger Events

Discussion in 'Visual Effect Graph' started by PolarbombVFX, Sep 6, 2023.

  1. PolarbombVFX

    PolarbombVFX

    Joined:
    Aug 22, 2023
    Posts:
    4
    Hello!

    Pretty new to the forums but have been developing games to Unity for a few years and Unreal and inhouse engines prior to that.

    VFX Graph is really cool and I've had a lot of fun with it so far! But I'm missing some stuff.

    I'm really missing Trigger Events for:
    Birth of a particle
    Collision (trigger on x amount of collisions, if you'd only want on first collision etc)

    Any specific reason these are not included in VFX Graph?
    Spawn at birth has been around in Shuriken for a while.
    And Spawn from Collision has been around in Unreal for a long time.

    Trigger Event Birth
    Super useful if you want a bunch of particles to spawn from the same location on a shape.

    Trigger Event on Collision
    Much better to use than Trigger Event On Die for spawning decals or marks in the environment.
    Let's say I have a big sparky thing that I want to kick off some extra sparks when it hits something.
    I can't use On Die for that. Then they'd just spark whenever they die and I can't guarantee that they'll die because of lifetime loss from collision.
     
  2. OrsonFavrel

    OrsonFavrel

    Unity Technologies

    Joined:
    Jul 25, 2022
    Posts:
    128
    Hello, thanks for your feedback and happy to know that you're having fun while using VFX Graph.
    I do agree that we're missing some Blocks and options in regard to trigger. Trigger on Birth, trigger on collision.
    We've been considering them and might add them in the future.

    In the meantime, you can use several workarounds:

    Trigger on Spawn:
    For Trigger on spawn, what you can do is to use a trigger event Always and Activate/deactivate it thanks to its Boolean Port. You can check if the Age of the particle is "Less" than DeltaTime. That should only spawn particles the first Frame.

    upload_2023-9-11_11-58-20.png
    upload_2023-9-11_12-0-55.png

    Unity_7BkGHZUe8N.gif

    Trigger on Collision:
    For Trigger on Collision, if you're okay with your colliding particles to instantly die when collided, then you can use the workaround by using the Lifetime Loss property. If you set it to 1.0, your particles will die instantly, and you can use the Trigger on Die block.

    But as mention earlier, those solutions are workaround, and will try to add more options in the future.
    Thanks again for your feedback and have a great day.
     
  3. PolarbombVFX

    PolarbombVFX

    Joined:
    Aug 22, 2023
    Posts:
    4

    Hello!

    Thank you for the detailed answer.

    Trigger on Die is not a good option. It has too many edge cases that can go wrong.
    If I use Trigger on Die, then that block sets a limit to particle behaviour.
    I can't use lifetimes shorter than X because then I might have particles sending off a trigger mid-air, and not on a collision.
    Or, the particle can only be used in an enclosed space with 4 walls, a floor and a ceiling so that it has something to collide against.
    Or, if used without close proximit walls, it needs gravity. A lot of it to make sure particles hit the ground.

    I hope these blocks find their way into VFX Graph soon!