Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Resolved How do I define custom, per-particle attributes?

Discussion in 'Visual Effect Graph' started by Program-Gamer, Oct 1, 2023.

  1. Program-Gamer

    Program-Gamer

    Joined:
    Nov 16, 2018
    Posts:
    14
    My use case is for a sword impact visual effect where each strike can vary in strength. My intention was to initialize this attribute's value based on an event payload sent via a C# script, then to use it throughout the graph to tune various aspects of the slash graphic depending on how "strong" the attack that caused the slash was.

    I know that in the unity 2023 alpha there's a new visual effect graph feature called the attribute blackboard, which seem like it does what I want, but I'd rather not upgrade from an LTS version, much less to an alpha if I don't have to (I'm currently on 2022.3). The wording of this feature's description is a bit ambiguous about whether having custom attributes was otherwise possible before, so I'd just like to know if there's a workaround or if I really have to wait for this feature to land in a stable, long term support version of unity before I can feel confident using it.

    Edit: I should add, it's important that this value be set on a per-particle basis since it's possible for multiple strikes of varying strength to be visible at once, so a property wouldn't cut it.
     
  2. Peplm

    Peplm

    Joined:
    Aug 2, 2019
    Posts:
    13
    Hi. This attributes blackboard seems to just be a thing that make the use of custom attributes easier, but doesn't really add any new functions.
    Why don't you use an exposed propertie that you set through C# ? Then depending of this value, create different behaviour with some logic.
     
  3. Program-Gamer

    Program-Gamer

    Joined:
    Nov 16, 2018
    Posts:
    14
    Because, as my edit says, using a property would affect existing particles as well.
     
  4. Program-Gamer

    Program-Gamer

    Joined:
    Nov 16, 2018
    Posts:
    14
    Ah, yes, I figured it out. I had to enable experimental features in order to be able to use the CustomAttribute nodes. Cool that this isn't mentioned anywhere in the documentation, but hey, at least I ended up figuring it out on my own.

    For future reference, this is what you want to enable once you installed the visual effects package:
    experimental features.png
     
    Marie_G likes this.