public static void SetKeyword(CommandBuffer cmd, string keyword, bool state) { if (state) { cmd.EnableShaderKeyword(keyword); } else { cmd.DisableShaderKeyword(keyword); } }
/// <summary> /// Set the global keyword for the provided MaterialQuality. /// </summary> /// <param name="level">MaterialQuality level to set the keyword for.</param> /// <param name="cmd">Command Buffer used to setup the keyword.</param> public static void SetGlobalShaderKeywords(this MaterialQuality level, CommandBuffer cmd) { for (var i = 0; i < KeywordNames.Length; ++i) { if ((level & (MaterialQuality)(1 << i)) != 0) { cmd.EnableShaderKeyword(KeywordNames[i]); } else { cmd.DisableShaderKeyword(KeywordNames[i]); } } }