Initialize | Visual Effect Graph | 10.2.2
docs.unity3d.com
    Show / Hide Table of Contents

    Initialize

    Menu Path : Context > Initialize Particle

    The Initialize Context processes a Spawn Event or a GPU Event and initializes new elements for a Particle or ParticleStrip simulation.

    Context settings

    Setting Type Description
    Space Enum (Inspector) The simulation space for the system.
    Data Type Enum (Inspector) The data type for the elements in the system. The options are:
    • Particle: The system spawns particles.
    • Particle Strip: The system spawns particle strips.
    Capacity UInt The fixed amount of elements in the simulation. This count scales the memory allocation of the particle system.
    Particle Per Strip Count Uint The fixed amount of particles per particle strip.
    This setting only appears if you set Data Type to Particle Strip.

    Context input properties

    Property Type Description
    Bounds AABox The bounding box defined for the system. This property is evaluated accordingly to the Culling Flags property defined in the Visual Effect Asset.

    Flow

    Port Description
    Input Connection from a Spawn, GPU Event, or Event Context. For more information on input flow compatibility, see Input flow compatibility.
    Output Connection to an Update (Single) or Output (Single/Multiple) Context.

    Details

    Overspawn

    To create new elements, you can add Blocks to the Context's body. The Visual Effect Graph adds these Blocks to the simulation if there is memory left to create them. After execution, Unity discards all elements that can not be injected this way.

    The Alive attribute

    Setting the Alive attribute to false in the Initialize context creates a dead particle.

    While doing this allows you to discard particles at their birth, overspawn still applies. The particle is considered dead only in the next update call. This means that you cannot create more particles (alive or dead) than the remaining count allows.

    Call order

    The Visual Effect Graph executes the Initialize Context only once per new element, prior to its first Update. At the frame of execution, the Visual Effect Graph initializes the new element, executes the element's first update, and finally renders the element.

    Source attribute availability

    In an Initialize Context, Blocks and Operators can read from source attributes, by using a Get Attribute (Source) Operator, or an Inherit <Attribute> Block.

    Input flow compatibility

    Initialize Contexts can connect from one or many SpawnEvent outputting contexts with the following rules:

    • Initialize Contexts can connect from any number of Spawn and/or Event Contexts.
    • Initialize Contexts can connect from a single GPU Event Context.
    • You can not mix GPU and CPU Event/Spawn Contexts to the input port. If you connect both GPU Event and Spawn Contexts, the Console shows the following error: Exception while compiling expression graph: System.InvalidOperationException: Cannot mix GPU & CPU spawners in init
    In This Article
    • Context settings
    • Context input properties
    • Flow
    • Details
      • Overspawn
      • Call order
      • Source attribute availability
      • Input flow compatibility
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023