UnityGame/Library/PackageCache/com.unity.render-pipelines.universal/Editor/ShaderGraph/AssetCallbacks/CreateCanvasShaderGraph.cs
2024-10-27 10:53:47 +03:00

28 lines
1.0 KiB
C#

using System;
using UnityEditor.ShaderGraph;
using UnityEngine.Rendering;
using UnityEditor.Rendering.Fullscreen.ShaderGraph;
namespace UnityEditor.Rendering.Universal.ShaderGraph
{
static class CreateCanvasShaderGraph
{
[MenuItem("Assets/Create/Shader Graph/URP/Canvas Shader Graph", priority = CoreUtils.Sections.section5 + CoreUtils.Priorities.assetsCreateShaderMenuPriority)]
public static void CreateCanvasGraph()
{
var target = (UniversalTarget)Activator.CreateInstance(typeof(UniversalTarget));
target.TrySetActiveSubTarget(typeof(UniversalCanvasSubTarget));
var blockDescriptors = new[]
{
BlockFields.SurfaceDescription.BaseColor,
BlockFields.SurfaceDescription.Emission,
BlockFields.SurfaceDescription.Alpha,
BlockFields.SurfaceDescription.AlphaClipThreshold,
};
GraphUtil.CreateNewGraphWithOutputs(new[] { target }, blockDescriptors);
}
}
}