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

30 lines
1.2 KiB
C#

using System;
using UnityEditor.ShaderGraph;
using UnityEngine.Rendering;
namespace UnityEditor.Rendering.Universal.ShaderGraph
{
static class CreateSpriteCustomLitShaderGraph
{
[MenuItem("Assets/Create/Shader Graph/URP/Sprite Custom Lit Shader Graph", priority = CoreUtils.Sections.section1 + CoreUtils.Priorities.assetsCreateShaderMenuPriority)]
public static void CreateSpriteLitGraph()
{
var target = (UniversalTarget)Activator.CreateInstance(typeof(UniversalTarget));
target.TrySetActiveSubTarget(typeof(UniversalSpriteCustomLitSubTarget));
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);
}
}
}