How do you hide a shader property?

There’s this method…

ShaderUtil.IsShaderPropertyHidden

…but what’s the ShaderLab syntax to make a property hidden?

2 Answers

2

You can hide Material Properties using using [HideInInspector] in front of the attribute

[HideInInspector]_SomethingHidden ("This text isn't shown", Float) = 1

This is useful when you have a property that is only set through a script, that should still have a default value when it’s not set. Regular default values for global variables in Cg are ingored; the variables are set to 0 instead. Adding a Material property allows you to set the default value there. Which the HideInInspector attribute then hides from the user.

Don’t declare it in the properties block - just code the definition of the variable.