Charge a Punch with New Unity Input System

Richard Morgan
Nov 19, 2022

--

Let’s have Virtual Al charge up a punch and explode a crate, like this:

For this we will add a slider and use the Hold interaction of our PlayerInputActions:

We’ll need to create a reference to our input actions, a new instance of our input actions, and subscribe to the actions:

For Actions.started we’ll activate our slider and start the coroutine that will advance the slider while the charge key is held:

And then we explode our crate with AddExplosionForce:

--

--

Richard Morgan
Richard Morgan

Written by Richard Morgan

Unity developer interested in AI integrations.

No responses yet