- Home /
Gradient issue with slider
I'm trying to create a bar that represents your combo, where the transparent blade part gets filled in by a gradient, and then a darker gradient, etc. The issue is that the slider stretches the filling to fit, but that shows the end color of the gradient in every situation. I'm currently trying to do something with a mask that is inverted (right to left that decreases), but haven't found anything useful yet. Is there a way that I can do a slider that reveals more of the filling instead of stretching it?
What my bar currently looks like:
What I want it to look like (photoshopped):
Answer by Serinx · Apr 29, 2018 at 09:38 PM
You could use a Sprite mask with a slider component. Add it on top of your health bar and change your health bar to a standard sprite. When the sprite mask slider is at 100% your health bar should be revealed, then slide to 0% to hide it.
I've been trying out your solution but I havent been able to get it down. Could you please explain this in more detail?
Your answer
Follow this Question
Related Questions
Alternative Slider Method 1 Answer
Change the Shape Unity's UI Sliders 1 Answer
Script updates prefab but not instantiated clone of prefab 0 Answers
How to assign callback function to Slider.onValueChanged 2 Answers
Weird UI slider behaviour 1 Answer