Search code examples
unity-game-engineuser-interfaceanimationshadershader-graph

Unity 2019 - Shader graph - How to recreate fill function in UIImage


I am trying to create a circular health bar that would deplete on the Y-axis. This works fine on a normal image with Image type filled and fill method - vertical but I want the texture to be animated.

I managed to create a shader that animates the texture but I can't work out how to replicate the fill method. I tried to use the Alpha cut threshold but it's not the desired behavior. Any ideas on how to do this?

enter image description here

note: I asked this question on Gamedev.stackexchange but it seems there is not as many members to help.


Solution

  • You can use a rectangle and modify its UV to get the desired effect.

    Example: enter image description here