CreateLitShaderGraph.cs 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using UnityEditor.ShaderGraph;
  3. using UnityEngine.Rendering;
  4. namespace UnityEditor.Rendering.Universal.ShaderGraph
  5. {
  6. static class CreateLitShaderGraph
  7. {
  8. [MenuItem("Assets/Create/Shader Graph/URP/Lit Shader Graph", priority = CoreUtils.Priorities.assetsCreateShaderMenuPriority)]
  9. public static void CreateLitGraph()
  10. {
  11. var target = (UniversalTarget)Activator.CreateInstance(typeof(UniversalTarget));
  12. target.TrySetActiveSubTarget(typeof(UniversalLitSubTarget));
  13. var blockDescriptors = new[]
  14. {
  15. BlockFields.VertexDescription.Position,
  16. BlockFields.VertexDescription.Normal,
  17. BlockFields.VertexDescription.Tangent,
  18. BlockFields.SurfaceDescription.BaseColor,
  19. BlockFields.SurfaceDescription.NormalTS,
  20. BlockFields.SurfaceDescription.Metallic,
  21. BlockFields.SurfaceDescription.Smoothness,
  22. BlockFields.SurfaceDescription.Emission,
  23. BlockFields.SurfaceDescription.Occlusion,
  24. };
  25. GraphUtil.CreateNewGraphWithOutputs(new[] { target }, blockDescriptors);
  26. }
  27. }
  28. }