Search Unity

Question VFX Graph: Temporarily saving variables for later use

Discussion in 'Visual Effect Graph' started by Tehenauin, Feb 27, 2023.

  1. Tehenauin

    Tehenauin

    Joined:
    Oct 18, 2018
    Posts:
    43
    I am not quit sure, if I use it the way it is meant to, but for my particle effect I am using the "Set Target Position" Block to save a Vector (for each Particle) and to use further down in my Graph via "Get Attribute: targetPosition" for different calculations.

    Now I would like to have more than this one Vector to save temporarily, is it possible? Is there something more generic like "Set Vector" or similar

    Thanks in advance for your help!
     
  2. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    326
    Hi. To load/store custom data per particle you can use custom attributes. There's a set custom attribute block and a get custom attribute operator. (experimental nodes have to be enabled in VFX preferences for those to appear in the node search)
     
  3. Tehenauin

    Tehenauin

    Joined:
    Oct 18, 2018
    Posts:
    43
    Thanks, that sounds like thing I am looking for.
    Unfortunately, If I add a "Set CustomAttribute" Block it takes only a float Value.
    And I also don't see a way to identify the attribute like with a tag or index.
     
  4. JulienF_Unity

    JulienF_Unity

    Unity Technologies

    Joined:
    Dec 17, 2015
    Posts:
    326
    Name and type can be changed in the inspector of the node.
     
  5. Tehenauin

    Tehenauin

    Joined:
    Oct 18, 2018
    Posts:
    43
    Ah, you are right! When working on the graph, I rarely look in the Editor. To be honest, I wasn't even aware, that these nodes have an Inspektor.
     
  6. Tehenauin

    Tehenauin

    Joined:
    Oct 18, 2018
    Posts:
    43
    Just another hint I want to add for people stumbling across this thread:

    The name of the attribute can't have spaces! I made this mistake at first and wondered why it was throwing errors and didn't work.