docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Attributes

    An Attribute is a piece of data attached to elements in a System. For example, the color of a particle, a particle's position, or the amount of particles that a spawn System creates are all Attributes.

    Systems can read from, or write to, Attributes in order to perform custom behavior and differentiate between elements.

    A System only stores Attributes when it needs them. This means that the System does not store any unnecessary data and thus saves memory.

    Using Attributes

    Writing Attributes

    To write to an Attribute, use a Block. Blocks are the only graph elements that can write Attributes to the System.

    The Visual Effect Graph only stores an Attribute that you write to in simulation data if a later Context reads the Attribute. This means that:

    • When you write to an Attribute in Initialize or Update Contexts, the Visual Effect Graph only stores the Attribute in simulation data if a later Update or Output Context reads from the Attribute.
    • When you write to an Attribute in Output Contexts, the Visual Effect Graph does not store the Attribute in simulation data and only uses the Attribute for rendering.

    Reading Attributes

    To read from an Attribute, use an Operator or Block:

    • Use a Get Attribute Operator.
    • Use different composition modes in a Set Attribute Block that depends on the previous value of the Attribute.

    Notes:

    • If you read from an Attribute that the Visual Effect Graph has not stored in the simulation data, the Attribute passes its default, constant value.
    • Currently, you can only read from Attributes in Particle and ParticleStrip Systems. To read from Attributes in Spawn Systems, use Spawner Callbacks.

    Attribute Locations

    Every System stores Attributes in its own specific data container. However, you can read an Attribute from the current simulation data pool or from another data pool that the System depends on.

    Current

    The current Attribute location refers to the current system data container that you read the value from. For example:

    • Particle Data from a Particle System.
    • ParticleStrip Data from a ParticleStrip System.
    • SpawnEvent Data from a Spawn Context or sent through a SendEvent EventAttribute Payload.

    Source

    The source Attribute location refers to the previous system data container that you read the value from. You can only read from a source Attribute in the first Context of a system, after a system data change. For example, you can only access EventAttributes and GPU EventAttributes in Particle / ParticleStrip System Initialize Contexts.

    • In Initialize Particle / Initialize Particle Strips Contexts:
      • From incoming Spawn Contexts.
      • From other Particle Systems, through GPUEvent spawn.

    Variadic Attributes

    Some attributes possess Variadic properties. These Attributes can be a scalar or a vector of different dimensions depending on the components you require for simulating and/or rendering.

    When you read from a variadic Attribute, it reads from all other implicit components using their default values.

    For example, you can express the scale of a Quad particle as a Vector2 (as the width, and length of the quad), whereas, to express the scale of a Box particle, you can use a Vector3 (as the width, length, and depth of the cube). When you set variadic attributes, a drop-down of all channel combinations allows you to write only to the necessary channels.

    Another example is for the rotation of a sprite around its normal. You only need the Z component of the angle Attribute (angleZ), so it is unnecessary to store angleX, and angleY.


    Did you find this page useful? Please give it a rating:

    Thanks for rating this page!

    Report a problem on this page

    What kind of problem would you like to report?

    • This page needs code samples
    • Code samples do not work
    • Information is missing
    • Information is incorrect
    • Information is unclear or confusing
    • There is a spelling/grammar error on this page
    • Something else

    Thanks for letting us know! This page has been marked for review based on your feedback.

    If you have time, you can provide more information to help us fix the problem faster.

    Provide more information

    You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:

    You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:

    You've told us there is information missing from this page. Please tell us more about what's missing:

    You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:

    You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:

    You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:

    You've told us this page has a problem. Please tell us more about what's wrong:

    Thank you for helping to make the Unity documentation better!

    Your feedback has been submitted as a ticket for our documentation team to review.

    We are not able to reply to every ticket submitted.

    In This Article
    • Using Attributes
      • Writing Attributes
      • Reading Attributes
    • Attribute Locations
      • Current
      • Source
    • Variadic Attributes
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)