Skip to main content
Version: 0.4.1

VFX Graph

Worlds can use Visual Effect Graphs for GPU particles: galaxies, ribbons of light, fireworks, sparks, smoke. Make a graph with Create → Visual Effects → Visual Effect Graph, add a Visual Effect component to an object in your world and give it the graph. The SDK package brings in the Visual Effect Graph package.

Scripts can control a Visual Effect:

Member
Play(), Stop(), Reinit(), pause, playRateStart, stop, restart, pause and speed up or slow down
SendEvent(name)Sends an event the graph listens for, such as a custom Burst event that spawns particles
SetFloat, SetInt, SetBool, SetVector2/3/4, SetTexture (and Get…, Has…)Set exposed properties by name
ResetOverride(name)Puts an exposed property back to the graph's value
aliveParticleCount, HasAnySystemAwake(), culledWhat the effect is doing
public VisualEffect fireworks;

public void Launch(Vector3 position, float hue)
{
fireworks.transform.position = position;
fireworks.SetFloat("Hue", hue);
fireworks.SendEvent("Burst");
}

Synced effects: SyncTime​

Particles are simulated on each player's GPU, so they are never synced one by one. To make an effect look the same for everyone, drive it from the room clock instead of from its own time:

  • Add an exposed Float property named SyncTime to the graph. StageTime sets it every frame to the room's synced clock in seconds (the same as Networking.GetServerTimeInSeconds()), wrapped every hour.
  • Use SyncTime instead of Total Time wherever the motion should match, such as rotation, colour cycles and positions along a path. Effects that only use SyncTime and the particle's own index look the same for every player, including players who joined late.

Things that happen at a moment, such as a firework, can be sent from a network event, or worked out from the clock on every device (for example one firework every 5 seconds at (int)(Networking.GetServerTimeInSeconds() / 5)). Synced values such as a colour go in a script's [Synced] fields, and the script sets them on the graph.

To make effects react to music, list them on an ST Audio Analyser.

Limits​

  • Capacity: the particle capacities of all the Visual Effects in a world add up to at most 2,000,000 on PC. The world builder reports an error above that, and a warning above 500,000, the budget on Quest and phones. A world over the budget on a device still loads, but its effects are turned off there.
  • Quest and Android: VFX Graph needs compute shaders, which StageTime runs with Vulkan. Fix Project Setup in the Build Window sets Android to Vulkan.
  • Graphs that read the depth or colour buffer, or use Shader Graph outputs that are not URP, may not render on every platform. Test on Quest.
  • Particles do not collide with players, and graphs cannot run scripts.