Is there good overview about using a single VFX system to play all effects of the same type? [Solved]

There was an old post from 2023 that talked about using a Visual Effect to play all the effects of the same type by using the VFXEventAttribute. Give it a new position, color etc. There was also a post about using this and a buffer to make a single Visual Effect spawn several effects per frame/script. Anybody know a good resource on getting behind this properly?

Look here: In case somebody is interested in learning about using the GraphicsBuffer - check out the ‘Tower’ example from the ‘The definitive guide to creating advanced visual effects in Unity’. Very interesting!

You can also take a look at the ECS Galaxy sample or at the recent Competitive Action Multiplayer template that you can download directly from the Unity Hub.

Both are using VFX Graph for all their VFX needs.

The Competitive Action sample seems pretty close to what you are looking for. Indeed, for each weapon, one VFX instance is responsible for handling all the weapon hits.

I hope this will help you get going.

Have a nice day.

I may be misunderstanding VFX Graph entirely here. An example to help clarify what I am trying to accomplish:

I want to spawn several bursts per frame. This could be done by placing several GameObjects with a Visual Effect component with the same VFX graph and triggering play. But is that the most efficient way of going about it?

From the ‘Tower’ example [Unity-Technologies / VisualEffectGraph-Samples], the ‘Lightning’ graph uses a GraphicsBuffer for the enemy positions instead of several GameObjects with a Visual Effect component. Is this part of what can make VFX Graph nice and efficient or is this simply a demonstration of using a GraphicsBuffer?

Here is some code to clarify what I did to avoid pooling several objects for bursts/explosions and just use some GraphicsBuffers to pass the positions to VFX. Just one object needed this way:

private VisualEffect burstEffect;
private GraphicsBuffer burstPositionBuffer;
private List<Vector3> positions = new List<Vector3>();
private int count = 0;

public void SetBurstPosition(Vector3 position)
{
    queueExploPlayer.Add(position);
}

void Awake()
{
    //Create buffer - reuse, only clear once the object is destroyed or disabled
    burstPositionBuffer = null;
    burstPositionBuffer = new GraphicsBuffer(GraphicsBuffer.Target.Structured, 256, 12);
    burstEffect.SetGraphicsBuffer("BurstPositions", burstPositionBuffer);
}

void Update()
{
    if (positions.Count > 0)
    {
        //Update the buffer - use 'Count' to only spawn particles at the current positions
        burstPositionBuffer.SetData(positions);
        burstEffect.SetInt("Count", positions.Count);
        burstEffect.SendEvent("OnPlay");

        //Clear positions for the next frame
        positions.Clear()
    }
}

void OnDestroy()
{
    burstPositionBuffer.Dispose();
}

Here is the VFX Graph. It spawns a particle at each burst position and then uses as GPU Event to spawn the actual burst effect:

This allows to use the graph to simultaneously spawn many bursts at once in a frame, each with their own unique properties.
is Unity only running three particle systems on the GPU in this case? Is the GPU event creating a new particle system each time I am spawning the origin particles? Is this better then spawning GameObjects with Visual Effect components? Is there something better/efficient then this?

Lots of questions - but I am really wondering if I am working in a wrong direction here. There are a lot features to go through in VFX Graph.

I haven’t checked in detail with the profiler yet - but reducing the capacity definitely shows this is running 3 particle systems and not one for each explosion/burst. If I were to use a pooled object with a Visual Effect, all referencing the same graph, the capacity is set for each pooled object - a separate set of particle systems for each object. Spawning explosions/bursts is much easier this way and the performance is also much better. I also managed to get this type of setup working with smoke trails and laser beams. 300-500 lasers can be a bottleneck when working with pooled objects and/or the line renderer, but having them all done by one object is a charm. I really like what VFX Graph can do!