Shader Graph feature references must end in "_ON" to be exposed?

I was scratching my head why my ShaderFeature once I had renamed the reference (to be easier to adjust from script) could no longer be exposed in the mat inspector. The “exposed” box was just grey and I couldn’t turn it on or off and it just defaulted to off.

I dug through the shader graph code and found this in ShaderKeyword.cs

internal override bool isExposable => m_IsExposable
            && (keywordType == KeywordType.Enum || referenceName.EndsWith("_ON"));

Well that explained it. Adding “_ON” fixed everything. Did I miss this or is this no where mentioned in the docs? Shouldn’t it maybe be a tooltip at least when you highlight the greyed out expose toggle?

2 Likes

https://docs.unity3d.com/Packages/com.unity.shadergraph@8.2/manual/Keywords.html

“To expose a Boolean Keyword in the Material Inspector, its Reference name must include the _ON suffix. For example, BOOLEAN_A506A032_ON.”

It’s in there, but indeed, better UX is needed.

1 Like