0 like 0 dislike
My current effect is a Storm Cloud with lightning and rotating debris scattered across a flattened cylinder shape area.  The lightning spawns at random points within the cylinder and it needs to spawn a light to flash up the environment in a localized area at just the right time and place.

Is there a way to expose the data for the particle spawn points so that the lights could be triggered in Unity at those locations through scripting etc?
related to an answer for: Lights in VFX in Unity?
by conan_thanoz (500 points)

1 Answer

0 like 0 dislike
Best answer

I'm not an Unity expert, so please forgive me if there's a better way to do this :)

As far as I know you won't be able to get the spawn positions of particles of an effect in C#.

What you can do though, is split your effect in two:

- the storm cloud
- the lightning

Have the lightning effect spawn just one lightning, and instantiate it multiple times from C#, at random positions, and spawn a light along with it each time ?


Side note: if you want your lightning particles to light-up the storm cloud particles, you could use spatial layers.
If you're interested in that but not sure on how to do it, please ask (ideally in a new topic), I'll try to put together an example.
by Julien (32.8k points)