In the UI the used material isn’t always the one set in the inspector (we duplicate materials internally for things like stenciling ect). Could you raise a bug on this so we can figure out a way forward to help make this work? You can probably use Shader.SetKeyword on the global scale for the moment, but it’s not the best solution going forward.
@Tim-C Actually, the Image component I was using had a Mask component on it. When I removed it my shader/material worked. Then it’s something related to the Mask component. So in my specific case I think it’s not a bug. But maybe that could work in a mask too, say, to have a mask animation, or just as an effect on the mask’s image. Do you want me to raise a bug on that anyway?
I faced the same problem yesterday and I couldn’t make it work using Unity 5.3.3, so I think the bug is still there, could you check it?
As IntDev explained, I was trying to apply an animation to the material assigned to an Image component who had a UI Mask component on it. If the Image component was attached to the Mask it didn’t work, if I removed the UI Mask the animation on the material of the Image component worked perfectly.
In my case I took a roundabout and created a material using a shader with a Culling mask and the image to apply to the Culling mask, then applied it to the Image component in order to avoid using the UI Mask, this way the animation works perfectly.