For the complete documentation index, see llms.txt. This page is also available as Markdown.

VFXRecipe

Overview

VFXRecipe is an object that lets you combine multiple VFX sources in a layered structure to build a composite effect and control its playback through scripts.

Whereas VFXPreset lets you choose from predefined effects, VFXRecipe lets you compose an effect yourself by placing VFX sources directly on three layers—Base, Detail, and Extra. Parameters such as each source's color, size, and transparency can be controlled at runtime through scripts, enabling a wide range of visual variations.

How to Use

Placing a VFXRecipe

Place a VFXRecipe at the desired location in the Level Browser.

Select the placed VFXRecipe to edit its layer composition and playback settings in the property panel.

Layer Composition

A VFXRecipe has three layers: Base, Detail, and Extra.

Layer
Role

BaseLayer

Responsible for the core visual elements of the effect. At least one source must be placed here.

DetailLayer

Adds finer details on top of the BaseLayer. Placement is optional.

ExtraLayer

Adds supplementary auxiliary effects. Placement is optional.

Click the + button on each layer to add a source. In the added source entry, click the VFX Source field to select a VFX source asset, and enter a name in the Name field. The name is used to identify the source when controlling parameters with GetParam / SetParam in scripts.

Playback Settings

Property
Description

AutoActivate

If true, playback starts automatically when the instance is activated. The default value is true.

InfiniteLoop

If true, the effect loops infinitely until Stop() is called. The default value is false.

LoopCount

The number of playback repetitions. Applied only when InfiniteLoop is false. The default value is 1.

LoopDuration

The duration (in seconds) of a single playback, calculated automatically by analyzing the parameters of the sources registered to the layers. It cannot be modified directly.

Controlling with Scripts

Play and Stop

Control effect playback manually with Play() and Stop(). When called from a server script, playback is automatically synchronized to all clients.

Detecting Playback Completion

When InfiniteLoop is false and playback finishes LoopCount times, the Finished event fires. It does not fire when playback is forcibly stopped with Stop().

Controlling Parameters

Use SetParam(SourceName, ParamName, Value) to change a source's parameters at runtime. Passing an empty string ("") as SourceName applies the change to every source on every layer at once.

Use GetParam(SourceName, ParamName) to read the current parameter value.

To specify a source by layer name and index instead of the source name, use SetParamAt / GetParamAt. Indexes start at 0.

Parameters Modifiable at Runtime

The parameters that can be changed at runtime with SetParam depend on the source's SpawnType.

Parameter
SpawnType
Description

Size

Common

Particle size scale

Color

Common

Particle color (ColorSequence)

Transparency

Common

Particle opacity (0–1)

Offset

Common

Particle spawn position offset (Vector3)

SpawnCount

burst

Number of particles spawned at once on activation

SpawnRate

rate

Number of particles spawned per second

Speed

rate

Particle movement speed (0–100)

BoundSize

rate

Size of the particle spawn area

Duration

rate

Emitter duration (seconds)

Complete Example

This example plays an effect, changes its color and size during playback, and restores the original values when playback finishes.

Scripting

VFXRecipe

Last updated