Adding Stencil properties to shader disables material properties editing?

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.