- Home /
HDRP Lit shader Double Sided property not updating when set by code
In the editor, while streaming GLB models and setting the double sided property of the HDRP Lit shader programmatically ( _DOUBLESIDED_ON), the changes are not taking effect.
I´ve tried using material.EnableKeyword("_DOUBLESIDED_ON") and while the EnableKeyword() is working correctly for NormalMaps and MaskMaps, setting the double sided property is not working. The result is always the same. No changes to the property are apparent on the respective game objects meshes in the scene or game views until I select the said game objects and click to open their material to view the shader in the inspector, at which time, the changes magically take effect as if the shader gets recompiled at that time.
Does anyone have any ideas? It seems that the variants of the HDRP Lit shader are not getting compiled, but maybe I´m missing something.
EDIT - UNITY VERSION: 2020.3.25f1 and 2020.3.29f1
Answer by highpockets · Feb 23 at 12:03 PM
Solved this.. After enabling the double sided property it seems it was fighting with the cull mode as it wasn´t setting the cull mode to none automatically. So the solution was to set the cull mode as well:
material.SetFloat("_CullMode", 0f);