I am in a situation where I want to reuse a particle “burst” effect, and adjust the amount of particles in the burst.
Right now I have a pretty convoluted VFX Graph set up where I specify a custom int on a dummy particle, which then dies immediately and triggers a GPU event, which spawns the real particles.
I’ve noticed that if I set the lifetime of this dummy particle to something very low (0 or 0.01), in certain situations, no particles get spawned. But it’s not clear to me when this happens (it seems to happen at specific timings related to when other particles spawn and/or when the vfx graph is initialized… but not sure on this). Setting the life of the dummy particle to 0.1 seems to resolve this issue.
I’m wondering if there is a better way of spawning a specific number of particles, where this number is supplied through a C# script?
So after looking through the direct link example here:
It turns out that spawnCount is actually a float, not a uint I guess the documentation isn’t updated, as it says spawnCount is a uint with a default value of (0,0,0)…
Just wanted to let you know that “Direct Link” isn’t always needed and that you can use regular “exposed properties” to control the spawnCount of an effect.
This approach is simpler to setup, and you can also set your properties values with C#.
In the case of an Exposed Burst/SpawnRate, the VisualEffect.SetFloat("name", float);public method should do the trick