public override void OnInspectorGUI()
{
var s = target as Shader;
if (s == null)
{
return;
}
GUI.enabled = true;
EditorGUI.indentLevel = 0;
ShowShaderCodeArea(s);
if (s.isSupported)
{
EditorGUILayout.LabelField("Cast shadows", (ShaderUtil.HasShadowCasterPass(s)) ? "yes" : "no");
EditorGUILayout.LabelField("Render queue", ShaderUtil.GetRenderQueue(s).ToString(CultureInfo.InvariantCulture));
EditorGUILayout.LabelField("LOD", ShaderUtil.GetLOD(s).ToString(CultureInfo.InvariantCulture));
EditorGUILayout.LabelField("Ignore projector", ShaderUtil.DoesIgnoreProjector(s) ? "yes" : "no");
string disableBatchingString;
switch (s.disableBatching)
{
case DisableBatchingType.False:
disableBatchingString = "no";
break;
case DisableBatchingType.True:
disableBatchingString = "yes";
break;
case DisableBatchingType.WhenLODFading:
disableBatchingString = "when LOD fading is on";
break;
default:
disableBatchingString = "unknown";
break;
}
EditorGUILayout.LabelField("Disable batching", disableBatchingString);
ShowKeywords(s);
// If any SRP is active, then display the SRP Batcher compatibility status
if (RenderPipelineManager.currentPipeline != null)
{
var mat = new Material(s);
mat.SetPass(0); // NOTE: Force the shader compilation to ensure GetSRPBatcherCompatibilityCode will be up to date
int subShader = ShaderUtil.GetShaderActiveSubshaderIndex(s);
int SRPErrCode = ShaderUtil.GetSRPBatcherCompatibilityCode(s, subShader);
string result = (0 == SRPErrCode) ? "compatible" : "not compatible";
EditorGUILayout.LabelField("SRP Batcher", result);
if (SRPErrCode != 0)
{
EditorGUILayout.HelpBox(ShaderUtil.GetSRPBatcherCompatibilityIssueReason(s, subShader, SRPErrCode), MessageType.Info);
}
}
ShowShaderProperties(s);
}
}