Adding Stencil properties to shader disables material properties editing?

Hi!, I could use some help with this one.

I have a UI element that is animated through a shader and everything works perfectly, but once I add Stencil properties to have the UI element masked, the Material properties in the game object get blocked and I can’t modify them, either through the inspector or in runtime.

In the editor it’s less of an issue since I can still change the properties in the Material file directly and have it updated in the game object by Ctrl+S, but the properties Is Increment, Increment Speed and Slider Width must be updated in runtime, and adding the Stencil properties forbid me to do so.

How can I unblock Material properties and still use the Stencil buffer?

These are the problematic lines, removing them allows me access to Material properties again:

I had this problem too. This thread has some discussion about it: Masked UI Element's Shader Not Updating – the tl;dr is that the material being rendered when you use a stencil is a modified version of the original material, so editing it wouldn’t work.

Replacing material with materialForRendering worked for me, but there are some other suggestions in there.