t1k:unity:rendering:vfx-graph
| Field | Value |
|---|---|
| Module | rendering |
| Version | 5.39.1 |
| Effort | medium |
| Tools | — |
Keywords: particle, VFX Graph, visual effects
How to invoke
Section titled “How to invoke”/t1k:unity:rendering:vfx-graphUnity VFX Graph — GPU Particle Effects
Section titled “Unity VFX Graph — GPU Particle Effects”Visual Effect Graph reference for Unity 6 (com.unity.visualeffectgraph). GPU-based, node-graph particle system.
VFX Graph vs Particle System
Section titled “VFX Graph vs Particle System”| Feature | VFX Graph | Particle System |
|---|---|---|
| Simulation | GPU (compute shader) | CPU |
| Particle count | Millions | Thousands |
| Node graph editor | Yes | Inspector-based |
| Mobile support | Requires compute shaders | Full support |
Rule: Use VFX Graph for high-count effects (rain, fire, magic, debris). Use Particle System for simple mobile-friendly effects.
C# Integration
Section titled “C# Integration”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); }}Hard rules
Section titled “Hard rules”- Requires compute shaders: Won’t work on low-end mobile GPUs (OpenGL ES 3.0 minimum)
- Exposed properties must be explicitly exposed: Right-click property → “Expose” in graph
- Event attributes not cached: Create
VFXEventAttributeonce, reuse - SRP only: Requires URP or HDRP — won’t work with Built-in RP
- 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
Related Skills & Agents
Section titled “Related Skills & Agents”t1k-unity-rendering-urp— Render pipeline integrationt1k-unity-rendering-shader-graph— Custom VFX shaderst1k-unity-mobile-core— Mobile VFX optimization
Reference Files
Section titled “Reference Files”| File | Contents |
|---|---|
architecture-and-recipes.md (references/architecture-and-recipes.md) | Spawn/Init/Update/Output contexts, events, property binders, effect recipes, performance tips, gotchas |
Visual change notice
Section titled “Visual change notice”A visible change made with this skill (UI, sprites, 3D, shaders, VFX, animation, lighting, scene layout; audio excluded) follows core rule visual-change-discord-notice:
- Capture OLD before the first edit and NEW after the last (screen:
ScreenCapturein Play mode pert1k-unity-editor-cli, windowed or Xvfb only because rendering is needed; 3D, shader, VFX: same-scene frame grab; 2D asset: the file). - Return the paths and a draft Discord post to the orchestrator, which posts; the PR links the post or carries
visual-notice-waiver: <reason>. Logic only: “no visible change”. No capture: “screenshots pending:”, never a fake image.