Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

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

Discussion in 'Shader Graph' started by Silly_Rollo, Aug 12, 2020.

  1. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    499
    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

    Code (CSharp):
    1. internal override bool isExposable => m_IsExposable
    2.             && (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?
     
    cultureulterior and florianBrn like this.
  2. alexanderameye

    alexanderameye

    Joined:
    Nov 27, 2013
    Posts:
    1,329
    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.
     
    Grav-8 likes this.
unityunity