Hi folks, We are using Shader.DisableKeyword and EnableKeyword to toggle between some colors in our shaders. ie a box is red in one environment, and blue in another. It seems to be working when playing in a build, but it is really flaky in the editor. (And today I can't get it to work at all, hence the forum post) Is there something about the editor that makes DisableKeyword and EnableKeywod fail? Is there anything I can do to make it work consistently?
There isn't anything particularly different about those keyword when in the editor. However I'd ask how and when you're calling them. There's some behavior, especially anything concerning cameras, that can behave very differently in the editor if you're not careful. Maybe try adding some debug logging and make sure those functions are only being called when you expect them to be and by the things you want. For example anything that uses Camera callbacks can potentially get called by the Scene or inspector preview camera.
Sorry for the slow reply. We are on 2020.3.1f1 URP 10.3.2 I have log statements next to the calls and have been monitoring when our code is called. Nothing weird going on with cameras.