Using Gradients in Unity

Objective: Have the fuel bar change color as the charge depletes.

To begin we need to use:

A Gradient can be used to easily shift between colors over time. Once the Gradient is serialized, you can adjust the gradient in the Unity Inspector:

Switch the Mode from Blend to Fixed and adjust the colors to how you want them.

Once you are done customizing the Gradient, we need to now access the Fill Image of our UI thruster slider to allow for the color change:

Finally, we can create a Method for handling the color change and call it in Update: