How to make an Animated Charge Bar

Objective: Create a bar that’ll charge up using IPointerHandler events!

There are some event system’s that we can use from Unity with the UI system. Here are some of the supported events.

Supported Events

The Event System supports a number of events, and they can be customized further in user custom user written Input…

docs.unity3d.com

To start this project, we will need a background image, a TextMeshPro Text object, a slider, and a button.

They can be placed where ever fits the design.

Now for the coding. We will only need one script. This script will need to grab the UnityEngine.UI, UnityEngine.EventSystems, and TMPro library's.

Once the UnityEngine.EventSystems is grabbed, add in after MonoBehaviour to inherit the IPointerDownHandler and the IPointerUpHandler. When these get typed in, the IDE that is being used will give you an error.

Website