UnityGame/Library/PackageCache/com.unity.shadergraph/Editor/Generation/Targets/CustomRenderTexture/CreateCustomRenderTextureShaderGraph.cs

25 lines
909 B
C#
Raw Normal View History

2024-10-27 10:53:47 +03:00
using System;
using UnityEditor.ShaderGraph;
using UnityEngine.Rendering;
namespace UnityEditor.Rendering.CustomRenderTexture.ShaderGraph
{
public static class CustomTextureShaderGraphMenu
{
[MenuItem("Assets/Create/Shader Graph/Custom Render Texture", priority = CoreUtils.Sections.section3 + CoreUtils.Priorities.assetsCreateShaderMenuPriority)]
public static void CreateCustomTextureShaderGraph()
{
var target = (CustomRenderTextureTarget)Activator.CreateInstance(typeof(CustomRenderTextureTarget));
target.TrySetActiveSubTarget(typeof(CustomTextureSubTarget));
var blockDescriptors = new[]
{
BlockFields.SurfaceDescription.BaseColor,
BlockFields.SurfaceDescription.Alpha,
};
GraphUtil.CreateNewGraphWithOutputs(new[] { target }, blockDescriptors);
}
}
}