Charge Beam Set Up

Gerald Clark
2 min readApr 24


In this article I’m going to get a little experimental. You’ll see a slight change in the look of the application I’ve been working on. Thats just so I can showcase how to use the New Input System in a way that creates a charge beam functionality. Lets go!

So first, I need to create the charge beam input action.

In the interactions section, I have it set to “Hold”. The idea here is to hold a button down and charge the shot then have the shot fire after a certain amount of time.

The Hold Time parameter is where I’m handling the amount of time the button should be held before it fires. This brings me to the Started, performed, and canceled properties.

Started is called when you actually press the button. After you hold the button for the amount of time determined in the Interactions field of the input action, Performed is called. If you let go of the button before that amount of time, Canceled is called.

In my code, I just have 3 game objects: 1 for the charge, 1 for the projectile, and one for the fire effect when the projectile leaves the ship. I also have a firePoint that I instantiate these game objects at.

This isnt the prettiest implementation, but for now this will work.

When I start the button pres the charge up is instantiated. Once I’ve held it for 2.5 seconds the projectile and pop effect are instantiated while the charge up is destroyed. When I cancel the charge up, it simply destroys the current Charge Up game object.

Thats all there is to it really. You can spice up/optimize this code to use object pooling or something to clean up the garbage that the Destroy() creates after a while. For this article I wanted to show how to use different interactions in a creative and fun way. Rapid prototyping FTW!

The final result! Simply hold the R key for 2.5 seconds and a lot of stuff happens!



Gerald Clark

Father Game Developer Music Composer Sound Designer