ConstantShaderVariable.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Amplify Shader Editor - Visual Shader Editing Tool
  2. // Copyright (c) Amplify Creations, Lda <info@amplify.pt>
  3. using System;
  4. using UnityEngine;
  5. namespace AmplifyShaderEditor
  6. {
  7. [Serializable]
  8. public class ConstantShaderVariable : ShaderVariablesNode
  9. {
  10. [SerializeField]
  11. protected string m_value;
  12. [SerializeField]
  13. protected string m_valueHDRP = string.Empty;
  14. [SerializeField]
  15. protected string m_valueURP = string.Empty;
  16. public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar )
  17. {
  18. base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar );
  19. if( dataCollector.IsTemplate )
  20. {
  21. if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HDRP && !string.IsNullOrEmpty( m_valueHDRP ) )
  22. return m_valueHDRP;
  23. if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.URP && !string.IsNullOrEmpty( m_valueURP ))
  24. return m_valueURP;
  25. }
  26. return m_value;
  27. }
  28. }
  29. }