Compilation error when linking output of a texture to a Spawn context parameter

Hello,

I am trying to control the rate of a constant spawn block and it works fine when I link an exposed float parameter to it, however if I try to link a value sampled from a 2D Texture I get a compilation error saying Exception while compiling expression graph: System.InvalidOperationException: The expression UnityEditor.VFX.VFXExpressionMax is not valid as it have the invalid flag: InvalidOnCPU

Is it normal ?

The reason I am using a texture instead of an exposed parameter is that I have several systems whose emission rates are linked to other objects in my scene and I find it easier and nicer to pack all the rates values in a texture instead of handling several parameters one by one.
This works fine when linked to block of other contexts by the way, only the Spawn context seems to not support this.

Thanks for any help.

Hi, I’m afraid using a texture to achieve this is not possible at the moment. We are adding an error feedback system in place that will make this fail more gracefully in the future with information within the VFX graph itself.

We do plan on adding other ways to send data into the graph, such as a compute buffer support.

1 Like

One year later, still doesn’t seem to be possible?

Hey @svenneve ,
Textures were always a workaround for sending large amount of data into the VFX Graph.
In latest 2021.2 we’ve added support for Graphics Buffer to enable sending large amounts of dynamic data to the VFX Graph from C#, so you can do things like this:

7302952--884515--GraphicsBuffer.gif