Changing Value Of Exposed Boolean In Material

I understand how to get and set a material’s property block, but how does one go about changing the value of an exposed boolean parameter in a material? I can’t find any method for doing so.

Boolean material properties are “fake”, Unity doesn’t actually support serialized (aka saved) boolean values on material assets. So instead they’re really float values that are set to 0.0 or 1.0. The material inspector knows it’s supposed to be a boolean, so it shows the check box in place of the float value, but from the script side it’s still a float.

TLDR: .SetFloat("_MyBoolean", myBoolValue ? 1f : 0f);

8 Likes

THAT…
IS…
AWESOME! Thanks so much for your help!

waaaauuuuuu!!!
Thanks