Creating custom VFX / Visual Effect Templates

Documentation and roadmap state that it’s possible to create custom templates for new VFX graphs:
https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@17.0/manual/Templates-window.html
https://portal.productboard.com/8ufdwj59ehtmsvxenjumxo82/c/2147-vfx-templates-and-wizard

Alas, it’s impossible to access classes: VFXTemplateDescriptor and VFXTemplateHelper as Unity states they don’t exist in the namespace UnityEditor.VFX.
Unity version: 2023.2.17
VFX Graph package version: 16.0.5

Could you develop a little bit on what you’re trying to achieve?

In the meantime, for people interested here is a very simple script that I’ve tested in Unity 2023.2.17f and Unity 6 Preview. It allows you to add Customs VFX templates in the template window.

using UnityEditor;
using UnityEditor.VFX;
using UnityEngine;

[InitializeOnLoad]
static class AddVFXTemplates
{
    static AddVFXTemplates()
    {
        VFXTemplateHelper.TrySetTemplate("Assets/VFX/VFXGraph/Templates_A/CustomTemplate_A.vfx",
            new VFXTemplateDescriptor
            {
                name = "myTemplateA",
                category = "Custom Examples",
                description = "My awesome custom Template A.",
                thumbnail = AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/VFX/VFXGraph/Templates_A/TX_Thumbnail_A.png"),
            });
     
        VFXTemplateHelper.TrySetTemplate("Assets/VFX/VFXGraph/Templates_B/CustomTemplate_B.vfx",
            new VFXTemplateDescriptor
            {
                name = "myTemplateB",
                category = "Custom Examples",
                description = "My Super custom Template B",
                thumbnail = AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/VFX/VFXGraph/Templates_A/TX_Thumbnail_B.png"),
            });
    }
}

9919833--1434528--Unity_nwVpMDldV9.gif

1 Like

I managed to achieve it on a different project which is using VFX graph package version 16.0.6, might be either that or RP package version that prevented me from accessing aforementioned classes?

Thanks for a quick reply, I guess the thread can be archieved since it works in newer versions

1 Like