VFX Graph - How do I access the VFXEventAttribute payload?

I want to spawn hundreds of explosions in quick succession.
Each explosion varies in position, duration, color, intensity etc...

Currently I am instantiating a new VFX graph object for each explosion and changing their exposed parameters, however this seems like a bad idea?

Instead I would like to create a single VFX graph and send VFXEventAttributes as parameters:

string eventName = "OnExplode"
void SendEvent(string eventName, VFXEventAttribute eventAttribute = null);

My question: How can I access these attributes/values within the blocks?

You can access it in the initialize context using get source attribute

Hi Julien,

When I do the following:

_attrib = _vfx.CreateVFXEventAttribute();        
_attrib.SetVector3("color-1", color);
_vfx.SendEvent("OnManualSpawn", _attrib);

I can't find the attribute "color-1" in the node graph editor. Am I misunderstanding how this works?

You need to use custom attributes nodes if you're not using built-in ones. You can activate them in preferences / vfx, enable use experimental blocks / operators

1 Like

They are currently activated but the only thing I can find is "Get CustomAttribute (Float)". I cannot find the "color-1" attribute.

In the inspector, there should be an option to set the name and type of your custom attribute

1 Like

Thank you. I am able to set up the custom attribute getter, however it doesn't seem to work. Do you see anything wrong here?

//this is called rapidly with different parameter values
public void Activate(float duration, Vector3 color, Vector3 position)
    {
        _attrib = _vfx.CreateVFXEventAttribute();
        _attrib.SetVector3("_position", position);
        _attrib.SetVector3("_color", color);
        _attrib.SetFloat("_duration", duration);
        _vfx.SendEvent("OnManualSpawn", _attrib);
    }

bump

I checked and there's is currently no way to specify source in the get custom attribute operator, this is a UI issues only but it prevents you to do what you want. Sorry about the false info. So you need to use built-in attributes at the moment (color instead of _color for instance)

bump on this topic. Seemed like a dead end then, and it still seems like a dead end now? Basically, how does one access the event attributes (passed from script) in the node graph?

Was just fighting with this problem for a few hours right now.

Everything in documentation gives the impression that it is possible to send custom attribute with event.
First you try to find how to get custom attribute node.
You search the forum and you find out that you have to enable experimental blocks.
Finally you add custom attribute node and than you realize it is not possible to specify custom attribute.

I always thought that experimental feature is something that actually is working.

UT should add another category in addition to experimental it should be called "ToDo".
You than would be able to download latest ToDo packages and just pretend you got it ;)

1 Like

Any updates on being able to access the VFXEventAttribute in the graph?

Bump, I'm trying to do this. Can't figure out how to spawn particles at different positions via events with the VFXEventAttributes

Just for anyone, when you add "Get Custom Attribute" just check the Inspector column, set of properties is there, As you can see, I changed the name to my custom "TextBufferStartPosition"
9174122--1277333--upload_2023-7-26_23-17-55.png

1 Like