Skip to content

t1k:unity:rendering:vfx-graph

FieldValue
Modulerendering
Version3.1.7
Effortmedium
Tools

Keywords: particle, unity, VFX Graph, visual effects

/t1k:unity:rendering:vfx-graph

Visual Effect Graph reference for Unity 6 (com.unity.visualeffectgraph). GPU-based, node-graph particle system.

FeatureVFX GraphParticle System
SimulationGPU (compute shader)CPU
Particle countMillionsThousands
Node graph editorYesInspector-based
Mobile supportRequires compute shadersFull support

Rule: Use VFX Graph for high-count effects (rain, fire, magic, debris). Use Particle System for simple mobile-friendly effects.

using UnityEngine.VFX;
public class VFXController : MonoBehaviour {
[SerializeField] VisualEffect vfx;
VFXEventAttribute hitAttr; // cache once, reuse per-call
void Start() {
vfx.Play();
vfx.Stop();
vfx.Reinit();
vfx.SetFloat("SpawnRate", 100f);
vfx.SetVector3("EmitPosition", transform.position);
vfx.SetVector4("Color", new Vector4(1, 0, 0, 1));
vfx.SetTexture("MainTex", myTexture);
vfx.SetBool("EnableTrails", true);
// CACHE event attribute once — never call CreateVFXEventAttribute() per-event.
hitAttr = vfx.CreateVFXEventAttribute();
int aliveCount = vfx.aliveParticleCount;
}
void OnHit(Vector3 hitPos) {
// Reuse cached hitAttr — overwrite values per-call.
hitAttr.SetVector3("position", hitPos);
hitAttr.SetFloat("damage", 50f);
vfx.SendEvent("OnHit", hitAttr);
}
}
  1. Requires compute shaders: Won’t work on low-end mobile GPUs (OpenGL ES 3.0 minimum)
  2. Exposed properties must be explicitly exposed: Right-click property → “Expose” in graph
  3. Event attributes not cached: Create VFXEventAttribute once, reuse
  4. SRP only: Requires URP or HDRP — won’t work with Built-in RP
  5. Particle System prefab warning: VFX Graph assets are .vfx, not .prefab

→ Full architecture (Spawn/Init/Update/Output contexts), events, property binders, effect recipes (Fire/Rain/Explosion/Magic), performance tips: references/architecture-and-recipes.md

  • unity-urp — Render pipeline integration
  • unity-shader-graph — Custom VFX shaders
  • unity-mobile — Mobile VFX optimization
FileContents
architecture-and-recipes.mdSpawn/Init/Update/Output contexts, events, property binders, effect recipes, performance tips, gotchas