Set Alive to false does not trigger Trigger Event On Die

I find myself often wanting to have particles with no particular lifetime set, but have logic for when that particle will die. If I want to trigger a GPU event on a particle’s death, the logical approach would be to use the Set Alive block to false and then expect a Trigger Event On Die block that follows it to flow onward to a GPU Event.

However, in practice, this does not work. My workaround is to set a particle’s lifetime to a very high number and then when I want it to do, conditionally use a block to set its lifetime to zero. It works, but it bothers me that I still have to set the lifetime at all in the Initialize block. I want the particle to be immortal until it isn’t anymore!

But also, it reads more clearly to just simply have a Set Alive false immediately followed by a Trigger Event On Die. And more than that, it feels like a bug for this NOT to work!

Setting the Alive attribute to false should work with a Trigger Event on Die:

eventCount = (age + deltaTime > lifetime || !alive) ? count : 0;

In my example, particles don’t have any lifetime, and the Alive attribute is set to false when their Y.position is under my reference plane Height.
Unity_4a37UT8dmn

Now, this allowed me to find and edge case, and I’m filling a bug for it. If you have a particle without a lifetime attribute, the value will default to 1.

Why? Because, many blocks/operators with the “OverLifetime” settings would trow NaN without a proper value.

And, without the lifetime attribute, the update won’t reap particles, but still Age particles:

This means, that after 1 sec, the condition : age + deltaTime > lifetime will be met and trigger particle although no Particle is dead…

Unity_xY2gXfumtI

So you need to turn off Age particle, in this scenario, which should be needed as aging particle could be required for something else.

Now, to resume, Setting the Alive Attribute manually to false is working with a Trigger Event on Die.
If you’re unable to make it work, please don’t hesitate to send your VFX as a small unity package with your Unity version number and I will take a look.

Meanwhile, I’ll create a bug related to the Trigger Event on Die that shouldn’t force you to disable to Age Particle option in the update.