Singularity/Library/PackageCache/com.unity.render-pipelines..../Editor/2D/ShaderGraph/AssetCallbacks/CreateSpriteLitShaderGraph.cs

30 lines
1.1 KiB
C#
Raw Normal View History

2024-05-06 14:45:45 -04:00
using System;
using UnityEditor.ShaderGraph;
using UnityEngine.Rendering;
namespace UnityEditor.Rendering.Universal.ShaderGraph
{
static class CreateSpriteLitShaderGraph
{
[MenuItem("Assets/Create/Shader Graph/URP/Sprite Lit Shader Graph", priority = CoreUtils.Sections.section1 + CoreUtils.Priorities.assetsCreateShaderMenuPriority + 1)]
public static void CreateSpriteLitGraph()
{
var target = (UniversalTarget)Activator.CreateInstance(typeof(UniversalTarget));
target.TrySetActiveSubTarget(typeof(UniversalSpriteLitSubTarget));
var blockDescriptors = new[]
{
BlockFields.VertexDescription.Position,
BlockFields.VertexDescription.Normal,
BlockFields.VertexDescription.Tangent,
BlockFields.SurfaceDescription.BaseColor,
UniversalBlockFields.SurfaceDescription.SpriteMask,
BlockFields.SurfaceDescription.NormalTS,
BlockFields.SurfaceDescription.Alpha,
};
GraphUtil.CreateNewGraphWithOutputs(new[] { target }, blockDescriptors);
}
}
}