Search Unity

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

Discussion in 'Visual Effect Graph' started by barbelot, Jul 8, 2020.

  1. barbelot

    barbelot

    Joined:
    Jul 18, 2017
    Posts:
    38
    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.
     
  2. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    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.
     
    barbelot likes this.
  3. svenneve

    svenneve

    Joined:
    May 14, 2013
    Posts:
    80
    One year later, still doesn't seem to be possible?
     
  4. VladVNeykov

    VladVNeykov

    Unity Technologies

    Joined:
    Sep 16, 2016
    Posts:
    550
    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:
     

    Attached Files: