I have a circular GameObject in Unity 2D with a SpriteRenderer attached.
I want to attach a custom component to my GameObject where I input a value between 0 and 1, with that inputted value corresponding to how much of a pie/cake slice shaped portion (i.e. a sector) of that GameObject I want to be rendered.
For example, see this illustration:
These renderings of a sprite would correspond to the values 0.25, 0.5, 0.75, 1 being inputted to my GameObjects custom component.
How do I create such an effect?
I would want different GameObjects to have this effect applied to them at the same point in time, possibly with different inputted values.
I assume I would have to implement this using an Unlit Shader, but I'm not sure quite how to write this shader, as well as have different GameObjects using different values at the same time for the input value.
The GameObject must use a SpriteRenderer, not an Image component.



