SetPropertyBlock for CanvasRenderer?

I wrote a custom shader for a floating health bar, world UI element, and noticed that setting properties on it was setting it for all objects using that material.

I found mentions of Renderer.SetPropertyBlock through some searches for how to fix that issue, but CanvasRenderer doesn’t include the SetPropertyBlock function.

Is there some work around or other method of dealing with this issue? Not being able to set the shader values in UI materials seems like a pretty big oversight.

All I could find related to this issue for specifically UI was this unanswered question from last year: http://answers.unity3d.com/questions/940525/how-to-set-pre-render-properties-to-ugui-image.html

Ended up finding a good solution from Reddit. Just Instantiate a new instance of the material object in Start().

Image imageComp = GetComponent<Image>();
imageComp.material = Instantiate(imageComp.material);

Popping in to say this is a great solution for the propertyBlock problem on Canvas’. Thanks!