Creating A Progress Bar w/ New Unity Input system

Suleiman Abdullah
3 min readMar 3


Objective:Creating A Progress Bar w/ New Unity Input system.

In the first step ,I will add a slider and position in the midle of my screen.Then create Csharp script called ChargerBar and create Input Action assets called PlayerInputActios,then I will genearate this class asets.

Create an action map called ChargeBar and action called Charging with bind of Space Key.

Open the Script and create reference for PlayeInput Actions asstes ,create Instance of it then enable Action Map .

Now Select the action <Property <Interaction ,then add press option.

In this step create function method of Start event .

Now we need to charge the ui when player press space key,first step we need to creat slider variable .Then get component of it.

Now we need to Create a bool variable called is charging and a coroutine make this increment ,then we define a while loop by add condition if is charging is true.Then we increment slider value every second using time.deltaTime and wait every frame to make smooth transition .

We need to set this bool to true when we hold space button and call coroutine in Charging Started method.

Now we need to create cancel method and set this bool to false.

Now we need to decrease the charging bar when player release the space key,to do this go to charging Routine and create another wile loop.Then check if slider value is greater than one ,then decrease slider value.

To make the charger bar decrese by custom time as we want ,we divide time.deltaTime /amount.

Lets see the result.

See you in the next article.



Suleiman Abdullah

Self taught Unity Developer, who is passion about making games ,and he loves Math For Game Development