Already Mad!! Can't get VFX sendEvent with eventAttribute correct

I don’t know if there’s a bug or something, my unity version is 2022.3.0

I’m reading posts after posts try to get the setup correct, but the output is weird.

As you can see from the screen shot uploaded, I’m trying to use single instancing vfx to spawn burning effect all around my game world. The current setup produce nothing when I send the event.

A few thing I checked:

  • the custom attribute “EffectCount” is an int with location set to “Source” as we should
  • the custom attribute is only accessed in the Initialization part of the graph
  • the bounds mode is set to “automatic” so it’s not a culling issue, there’s no particle spawned
  • Debug.Log is used to ensure the attribute is indeed set correctly

Some funny thing:

If I set “EffectCount” location to “current”, It works !!! but partially
the funny part of this is that I read “EffectCount” twice in the graph

  • the first time I read it and multiply it with particleCount, it actually works
  • and I used it with some modulo operation to get the correct index, it fails, somehow its value is 0 now…

Even funnier thing:

I tried default attribute “spawnCount” as well, with setFloat, and it’s not working at all with “current” or "source"

Hello,

The confusion comes from the “source” attribute which is only valid while connected to an Initialize Context.
Within Spawn Context, the payload of attribute is always copied from a context (or event) to another Spawn Context, you should use “current”.

In your case, the correct setup would be this graph:

To illustrate a bit more the issue, here a setup simulating an event sent from script and highlighting the difference between current and source in Initialize Context:
9615068--1364567--_repro_current_source.gif

We planned to address missing error feedbacks in case of reading source in incorrect context with more recent version of Unity.

Thank you ! That solves it, eventually !

I read this 3 times and still don’t know what you said. It sounds like something about GPU pipeline, which is the wrong way to talk to VFX artists.

A good inspiration for the team is Niagara. It hides all that GPU stuff and, when an error exists, it presents clear error messages with a [FIX] button.

Another way to bring much needed clarity is to color code the node by compatible modules.

And while on the topic of colors, the performance heatmap is hard to read because only a small line is colorized. What is better is always to color the entire node.

I have to admit my explanation is lacking of context to be fully understood:
Every time a flow link is crossing outside of a system (which is represented by a dash line), there is a transmission of VFXEventAttribute, it occurs with two typical cases:

  • Spawn Context plugged to an initialize context: the attribute “source” reading will refer to spawn context data.
  • GPU Event plugged to an initialize context: the attribute “source” reading will refer to parent system data.

Now, technically, every single Spawn Context is an independent system. However, the Spawn System doesn’t support “source” attribute reading, it’s like you implicitly have an “Inherit Attribute” block for every single available attributes. This is why you should use “current” in Spawn Context.

This is the confusion we would like to address with missing error feedbacks: With 22.3, “source” attribute nodes should only be connected to an Initialize Context.
So far, we generally aren’t doing automatic resolution but this is something we could consider.

Are you referring to this heatmap ?
9625673--1366898--upload_2024-2-5_14-58-25.png

This integration is specific to Shader Graph, I’m going to forward your feedback. In VFX, the color code for nodes isn’t relative to performance.

9625673--1366895--upload_2024-2-5_14-58-4.png

There was a heatmap added a while back, or maybe it’s a future feature that I saw a screen shot for.

must not should. VFX graph is more complicated to use than Niagara and a big reason why its adoption is so low.

I have used VFX graph a lot for a switch port and I forgot all this stuff. It’s interesting to know, yes, but no VFX artist I know want to be this close to the metal.

That’s because, in creative mode, you want to flow through creation and what you gave us is basically compute shader lego. Super powerful but insanely unintuitive to use.

Have you (the team) used Niagara?

On a tangent: do you have plans to extend it to be “visual scripting for compute shader”?