CreateUnlitShaderGraph.cs 939 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using UnityEditor.ShaderGraph;
  3. using UnityEngine.Rendering;
  4. namespace UnityEditor.Rendering.Universal.ShaderGraph
  5. {
  6. static class CreateUnlitShaderGraph
  7. {
  8. [MenuItem("Assets/Create/Shader Graph/URP/Unlit Shader Graph", priority = CoreUtils.Priorities.assetsCreateShaderMenuPriority + 1)]
  9. public static void CreateUnlitGraph()
  10. {
  11. var target = (UniversalTarget)Activator.CreateInstance(typeof(UniversalTarget));
  12. target.TrySetActiveSubTarget(typeof(UniversalUnlitSubTarget));
  13. var blockDescriptors = new[]
  14. {
  15. BlockFields.VertexDescription.Position,
  16. BlockFields.VertexDescription.Normal,
  17. BlockFields.VertexDescription.Tangent,
  18. BlockFields.SurfaceDescription.BaseColor,
  19. };
  20. GraphUtil.CreateNewGraphWithOutputs(new[] { target }, blockDescriptors);
  21. }
  22. }
  23. }