Table of Contents

Method Particles

Namespace
Velvet
Assembly
Velvet.Docs.dll

Particles(ParticleSystem?, string?, string?, string?, PlayTrigger, float, StyleOverrides?, Func<VisualElement, Action>?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?, FiberEventBinding[]?)

Creates a Particles element that simulates effect in a hidden, framework-owned host and draws the geometry its renderers build inside the element, with no camera and no world-space canvas. The simulation host is instantiated on mount (its renderers disabled; only the simulation is consumed), destroyed on unmount, and recreated when effect changes.

public static ElementNode Particles(ParticleSystem? effect, string? className = null, string? key = null, string? name = null, PlayTrigger playOn = PlayTrigger.Mount, float pixelsPerUnit = 100, StyleOverrides? styles = null, Func<VisualElement, Action>? refCallback = null, string? whileHoverClass = null, string? whileTapClass = null, string? whileFocusClass = null, IReadOnlyDictionary<string, string>? data = null, IReadOnlyDictionary<string, string>? aria = null, FiberEventBinding[]? events = null)

Parameters

effect ParticleSystem

The source ParticleSystem (typically a prefab reference) to simulate. Null mounts an inert element until an effect is supplied.

className string

CSS-like utility class string. Multiple classes separated by spaces.

key string

Key used to disambiguate siblings at the same position.

name string

Element name assigned to UnityEngine.UIElements.VisualElement.name for query/debug.

playOn PlayTrigger

When the effect starts: on mount (default) or never (manual control).

pixelsPerUnit float

World-unit → element-pixel mapping for particle positions and sizes, centered on the element. Must be positive.

styles StyleOverrides

Inline style overrides applied on top of USS classes.

refCallback Func<VisualElement, Action>

Callback invoked on mount with the created VisualElement; returned Action runs on unmount.

whileHoverClass string

USS class toggled while the pointer hovers the element (gesture-driven).

whileTapClass string

USS class toggled while the pointer is pressed on the element (gesture-driven).

whileFocusClass string

USS class toggled while the element holds keyboard/UI focus (gesture-driven).

data IReadOnlyDictionary<string, string>

data-* attribute map matched by data-[...] variants.

aria IReadOnlyDictionary<string, string>

aria-* attribute map matched by aria-[...] variants.

events FiberEventBinding[]

Event bindings applied to the element (Documentation~/react-migration.md owns the rule). The array is read and never written.

Returns

ElementNode

The created ElementNode representing this particles element.

Exceptions

ArgumentOutOfRangeException

Thrown when pixelsPerUnit is not positive, or when playOn names no member of PlayTrigger.

Particles(VisualEffect?, string?, string?, string?, PlayTrigger, float, StyleOverrides?, Func<VisualElement, Action>?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?, FiberEventBinding[]?)

Creates a Particles element that plays a VFX Graph visualEffect in a hidden, framework-owned clone and shows what a camera under that clone renders of it, over the element's laid-out box. The clone is instantiated on mount, destroyed on unmount, and recreated when visualEffect changes.

public static ElementNode Particles(VisualEffect? visualEffect, string? className = null, string? key = null, string? name = null, PlayTrigger playOn = PlayTrigger.Mount, float pixelsPerUnit = 100, StyleOverrides? styles = null, Func<VisualElement, Action>? refCallback = null, string? whileHoverClass = null, string? whileTapClass = null, string? whileFocusClass = null, IReadOnlyDictionary<string, string>? data = null, IReadOnlyDictionary<string, string>? aria = null, FiberEventBinding[]? events = null)

Parameters

visualEffect VisualEffect

The source VisualEffect (typically a prefab reference) to play. Null mounts an inert element until an effect is supplied.

className string

CSS-like utility class string. Multiple classes separated by spaces.

key string

Key used to disambiguate siblings at the same position.

name string

Element name assigned to UnityEngine.UIElements.VisualElement.name for query/debug.

playOn PlayTrigger

When the effect starts: on mount (default) or never (manual control).

pixelsPerUnit float

World-unit → element-pixel mapping, centered on the element. Must be positive.

styles StyleOverrides

Inline style overrides applied on top of USS classes.

refCallback Func<VisualElement, Action>

Callback invoked on mount with the created VisualElement; returned Action runs on unmount.

whileHoverClass string

USS class toggled while the pointer hovers the element (gesture-driven).

whileTapClass string

USS class toggled while the pointer is pressed on the element (gesture-driven).

whileFocusClass string

USS class toggled while the element holds keyboard/UI focus (gesture-driven).

data IReadOnlyDictionary<string, string>

data-* attribute map matched by data-[...] variants.

aria IReadOnlyDictionary<string, string>

aria-* attribute map matched by aria-[...] variants.

events FiberEventBinding[]

Event bindings applied to the element (Documentation~/react-migration.md owns the rule). The array is read and never written.

Returns

ElementNode

The created ElementNode representing this particles element.

Exceptions

ArgumentOutOfRangeException

Thrown when pixelsPerUnit is not positive, or when playOn names no member of PlayTrigger.